PHPackages                             gluck2233/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. gluck2233/patreon

ActiveLibrary[API Development](/categories/api)

gluck2233/patreon
=================

Interact with the Patreon API via OAuth.

v1.0.2(2y ago)067↓100%1[1 PRs](https://github.com/gluck2233/patreon-php/pulls)Apache-2.0PHPPHP &gt;=8.0.0

Since Dec 7Pushed 2y agoCompare

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

READMEChangelog (3)Dependencies (5)Versions (4)Used By (0)

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

[](#patreon-php)

[![Support me on Patreon](https://camo.githubusercontent.com/ae355e7db39debb55bc65b4bba72b57fd55a100b7638b19160cd66adeb252303/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e742e7376673f75726c3d6874747073253341253246253246736869656c6473696f2d70617472656f6e2e76657263656c2e617070253246617069253346757365726e616d65253344736f61746f6b25323674797065253344706174726f6e73267374796c653d666f722d7468652d6261646765)](https://patreon.com/soatok)

[![Build Status](https://github.com/soatok/patreon-php/actions/workflows/ci.yml/badge.svg)](https://github.com/soatok/patreon-php/actions)[![Latest Stable Version](https://camo.githubusercontent.com/3e1e5a0810196a98869c98198925760c10c7209baf4e078fdeeb6d1ea7a934ed/68747470733a2f2f706f7365722e707567782e6f72672f736f61746f6b2f70617472656f6e2f762f737461626c65)](https://packagist.org/packages/soatok/patreon)[![Latest Unstable Version](https://camo.githubusercontent.com/a1e892f2ab98182f78f21177914154c04dca452db1b430dfab071f5706995738/68747470733a2f2f706f7365722e707567782e6f72672f736f61746f6b2f70617472656f6e2f762f756e737461626c65)](https://packagist.org/packages/soatok/patreon)[![License](https://camo.githubusercontent.com/e524f75b5c9c6c2d7ac5984b4cdf6a8f53485f799afc11640ecb8edf399305b8/68747470733a2f2f706f7365722e707567782e6f72672f736f61746f6b2f70617472656f6e2f6c6963656e7365)](https://packagist.org/packages/soatok/patreon)[![Downloads](https://camo.githubusercontent.com/c0165578084ff69d464a2c7cc0e89d55c3d633ec10763993732026dde8558a7f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736f61746f6b2f70617472656f6e2e737667)](https://packagist.org/packages/soatok/patreon)

This is Soatok's fork of the [Patreon-PHP](https://github.com/Patreon/patreon-php) library.

Interact with the Patreon API (version 2) via OAuth. **Requires PHP 7.**

Differences Between This Library and Patreon's
----------------------------------------------

[](#differences-between-this-library-and-patreons)

- This library requires PHP 7 or newer, Patreon's only requires PHP 5.3.
- This library loads in the [hidden-string](https://github.com/paragonie/hidden-string)package (which prevents secrets from leaking in stack traces) and the [sodium\_compat](https://github.com/paragonie/sodium_compat) package (used to make sure if libsodium is available-- even in a weird way-- it will be accessible in the standardized PHP 7.2+ API).
- This library uses BLAKE2b for response caching instead of MD5 (if possible).
- This library features the new `Patreon\AuthUrl` class which generates an authentication URL without having to manually URL-encode and concatenate strings.
    - This should make it even easier for PHP developers to integrate with Patreon via OAuth.

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

[](#installation)

Get the plugin from [Packagist](https://packagist.org/packages/soatok/patreon):

```
composer require soatok/patreon

```

Although it's possible to load this library without using Composer, [it's highly recommended that you use Composer](https://paragonie.com/blog/2017/12/2018-guide-building-secure-php-software#dependency-management).

Soatok will not support non-Composer installs.

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](https://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).)*

```
