Patreon Platform API Library for modern PHP. Documented, tested, maintained.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.circleci
docs
src/Patreon
tests/Patreon
.gitignore
LICENSE
README.md
composer.json
composer.lock
phpunit.xml

README.md

Patreon PHP

Packagist license CircleCI branch Maintainability Test Coverage

A PHP library for interacting with the Patreon Platform, designed to provide the easiest path for integrating Patreon into your application with a simple interface that abstracts away the underlying Patreon API.

Requirements

Installation

Patreon PHP is available on Packagist.

composer require squid/patreon php-http/guzzle6-adapter

You may swap out php-http/guzzle6-adapter for your own HTTPlug Compatible Client, such as the cURL client or the React HTTP Adapter.

How To Use

After you've installed the package you're ready to instantiate a client with your access token and then request data for resources.

use Squid\Patreon\Patreon;

$patreon = new Patreon('access_token');
$campaign = $patreon->campaigns()->getMyCampaignWithPledges();

echo "Hello, {$campaign->creator->full_name}! You have {$campaign->patron_count} patrons.\n";

$campaign->pledges->each(function ($pledge) {
    echo "{$pledge->patron->full_name} has been a patron since {$pledge->created_at}.\n";
});

Learn More

Documentation is available covering all aspects of the library, from getting started to architecture, or you can get started by looking at some examples of how to achieve the most common integrations.

  1. Getting Started
  2. Obtaining OAuth Tokens For Patrons
  3. Patreon Integration Examples
  4. Method Documentation
  5. Library Architecture

Examples

A full example project that you can download and use is available at 1f991/patreon-php-example which includes:

  • Display a list of Patrons
  • Instantly add/delete/update patrons using Webhooks
  • Allow Patrons to log in with OAuth

A demo of the example project can be found live at patreon.1f991.com where you can create a pledge and log in to see it in action.

Alternatively, smaller self-contained examples of specific implementations are available in the documentation for this project:

Getting Help

Please visit the Patreon Developers forum with any questions you have about using this library, or the Patreon Plaform. Please report any bugs found in this library by creating a new issue. A reproduceable test case should be included where possible, otherwise a description of your problem and steps to reproduce would be very helpful.

Dependencies

This library has been made possible by the fantastic open source contributions of others, including...

Security Vulnerabilities

Please reach out to Samuel Ryan via email (sryan@1f991.com) to report any security concerns you may have discovered with this library. Acknowledgement will be provided within 24 hours.

License

Patreon PHP is open-sourced software licensed under the MIT license.