Coder Social home page Coder Social logo

patreon-feed's Introduction

Patreon feed

3rd party library to pull posts from a creator's Patreon feed and generate an RSS file.

Usage

Caching

To cache any of Campaigns, Posts or Members add this:

\daemionfox\Patreon\API\Campaigns::setAllowCache(true); // Must be true to cache, default is false
\daemionfox\Patreon\API\Campaigns::setCacheDir('/path/to/cache');  // Must be set, cache will fail if not set
\daemionfox\Patreon\API\Campaigns::setCacheDir('numSeconds');  // default 14400 (4 hours)

To turn on caching across all things this will work:

\daemionfox\Patreon\API\APIAbstract::setAllowCache(true); // Must be true to cache, default is false
\daemionfox\Patreon\API\APIAbstract::setCacheDir('/path/to/cache');  // Must be set, cache will fail if not set
\daemionfox\Patreon\API\APIAbstract::setCacheDir('numSeconds');  // default 14400 (4 hours)

Data

$creator_access_token = 'sometoken_gotten_from_patreon_api_auth';
// Get Patreon posts
$patreon = \daemionfox\Patreon\API\Posts::init($creator_access_token);
$posts = $patreon->getPosts();
print_r($posts);
// Get Patreon campaign data
$patreon = \daemionfox\Patreon\API\Campaigns::init($creator_access_token);
$campaignID = $patreon->getCampaignID();
$tiers = $patreon->getTiers();
$goals = $patreon->getGoals();
// Get Patreon member data
$patreon = \daemionfox\Patreon\API\Members::init($creator_access_token);
$members = $patreon->getMembers();
print_r($members);
// Get RSS feed
$patreon = new \daemionfox\Patreon\Feed($creator_access_token);

// Optional:
$patreon->setPostLimit(20); // Sets the number of posts returned in the feed.  Default 10
$patreon->setShowPrivatePosts(true); // Decide if you want to show non-public posts in the feed

// Return the feed
$rss = $patreon->rss();

echo $rss;

Changelog

0.1
  • Initial Commit
0.2
  • Changed to OOP architecture
0.2.1
  • Updated readme, and moved cachePath to a static property
3.0
  • Complete re-build from scratch using Patreon API to retrieve data

patreon-feed's People

Contributors

daemionfox avatar criztovyl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.