PHP 7+ Fork of the Official Patreon-PHP Library

The official PHP library has some issues:

  1. The minimum supported version is PHP 5.3, when the minimum you should be targeting is 7.2 (until December, then it should be 7.3).
  2. There are no unit tests.
  3. There is a lot of redundant code that could be refactored.
  4. There is a lot of unneeded manual work that could be replaced with http_build_query().
  5. The API is not type-safe.

I decided to fix all these issues and add a helper class that builds a full-featured authorization URL without having to manually URL encode anything.

Check it out here: soatok/patreon.

Note: In addition to the code quality improvements, I’m also actively maintaining my fork. If you encounter any issues or would like to request an integration, feel free to open an issue.

Quoting my reply at github for reference,

We are aiming to have this lib cover the maximum amount of different PHP versions, web hosts, different hosting infrastructures and development environments possible. The neat changes you have made may effect the amount of environments we are able to cover with this lib.

As discussed in github, we will link to your fork for those who may want to use it.

@soatok I previously launched (and abandoned) an improved PHP library, which can be found at 1f991/patreon-php. I moved on from my Patreon projects so I archived the project and haven’t worked on it in a while – and as far as I know it has no users – but if you’d like to salvage any parts of it, feel free to re-use it in part (or whole) in your efforts to modernise the official library :slight_smile: Switching away from cURL and to an HTTP client abstraction is a great next step that greatly benefits testing.

1 Like

Readme is now updated with your fork in notes in the first section.

If anyone else has any fork which you would like get listed in the readme, please let us know.

In your forks, we would prefer if you used names (or wrappers) for higher level functions that are present in our repo for similar functionality (ie fetch_user etc) - this would make your fork more compatible and easy to integrate for everyone. With the same input and returns (albeit extended if necessary) of course.