PHPackages                             kagurati/patreon - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. kagurati/patreon

ActiveLibrary[API Development](/categories/api)

kagurati/patreon
================

Interact with the Patreon API via OAuth.

1.1.0(4y ago)0130MITPHPPHP &gt;=5.3.0

Since Oct 9Pushed 4y agoCompare

[ Source](https://github.com/Zanaras/patreon-php)[ Packagist](https://packagist.org/packages/kagurati/patreon)[ RSS](/packages/kagurati-patreon/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (12)Used By (0)

patreon-php
===========

[](#patreon-php)

This is Zanaras's fork of the [Patreon-PHP](https://github.com/Patreon/patreon-php) library, which facilitates interacting with the Patreon API via OAuth.

Differences from Patreon/patreon-php
------------------------------------

[](#differences-from-patreonpatreon-php)

This code has been modified in several ways but should be hot-swap capable with Patreon/patreon-php version 1.0.0.

In particular, it removes an unused variable on the OAuth.php refresh\_token function, allows passing cache arguments through the API.php fetch\_\* functions, allows setting API functions on class instantiation, and streamlines a few conditional arguments in the API.

Important notice about updating to 1.0.0 from earlier versions
--------------------------------------------------------------

[](#important-notice-about-updating-to-100-from-earlier-versions)

Patreon PHP library version 1.0.0 moves on to Patreon's v2 API, which is not compatible with old v1 calls. It also removes Art4 JSON library. Therefore directly upgrading from older versions to 1.0.0 would break compatibility of your installation. APIv1 will deprecated some time soon after APIv2 come out of beta, so its important to get your integration compatible with API v2. With API v2, you can only get access to the scopes you requested during authorization, and you need to ask for the data you want through includes.

If you were using Art4 library before, you can separately install it and feed the return from API calls to Art4 library after getting it as JSON from this library. This will make your existing code that uses Art4 library compatible. However note that you will need to track Art4 library updates and resulting compatibility issues yourself.

NOTE: This library is made to be compatible with the maximum possible variety of different infrastructures, PHP versions and environments in order to cover a majority of potential integrations. If you would like to use more specialized versions of this lib with different amenities and additions/dependencies to better suit your environment, below is a list. If you would like your fork added to this list, please contact us [at the forums](https://www.patreondevelopers.com/).

[soatok's fork](https://github.com/soatok/patreon-php) with PHP 7.x, PHPunit, Psalm, BLAKE2b instead of MD5

Installation
------------

[](#installation)

> php composer.phar require kagurati/patreon

Usage
-----

[](#usage)

### Step 1. Get your client\_id and client\_secret

[](#step-1-get-your-client_id-and-client_secret)

Visit the [Patreon platform documentation page](https://www.patreon.com/platform/documentation) while logged in as a Patreon creator to register your client.

This will provide you with a `client_id` and a `client_secret`.

### Step 2. Use this plugin in your code

[](#step-2-use-this-plugin-in-your-code)

Let's say you wanted to make a "Log In with Patreon" button.

You've read through [the directions](https://www.patreon.com/platform/documentation/oauth), and are trying to implement "Step 2: Handling the OAuth Redirect" with your server.

The user will be arriving at one of your pages *after* you have sent them to \[the authorize page\] ([www.patreon.com/oauth2/authorize](http://www.patreon.com/oauth2/authorize)) for step 1, so in their query parameters landing on this page, they will have a parameter `'code'`.

*(If you are doing something other than the "Log In with Patreon" flow, please see [the examples folder](examples) for more examples)*

*(Especially the unified flow is a great way to have users unlock locked features or content at your site or app - it allows users to register, login, pledge and return to your app in one smooth unified flow. Check it out in [the examples folder](examples) )*

```
