PHPackages                             flipboxfactory/patron - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. flipboxfactory/patron

ActiveCraft-plugin[Authentication &amp; Authorization](/categories/authentication)

flipboxfactory/patron
=====================

An OAuth2 Client for Craft CMS

5.0.0(6mo ago)310.0k2[3 issues](https://github.com/flipboxfactory/patron/issues)3MITPHPPHP &gt;=8.0

Since Mar 30Pushed 6mo ago2 watchersCompare

[ Source](https://github.com/flipboxfactory/patron)[ Packagist](https://packagist.org/packages/flipboxfactory/patron)[ RSS](/packages/flipboxfactory-patron/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (10)Versions (27)Used By (3)

An OAuth2 client manager for Craft CMS
======================================

[](#an-oauth2-client-manager-for-craft-cms)

[![Join the chat at https://gitter.im/flipboxfactory/patron](https://camo.githubusercontent.com/5a4e1a56a15913a70e4d5429325e163297a585250080245d8f3acbf5dbcc6c50/68747470733a2f2f6261646765732e6769747465722e696d2f666c6970626f78666163746f72792f706174726f6e2e737667)](https://gitter.im/flipboxfactory/patron?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![Latest Version](https://camo.githubusercontent.com/a3db26b7b9d71b8eab814578206733331248fe4a41225480710e4e46de457fd1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f666c6970626f78666163746f72792f706174726f6e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/flipboxfactory/patron/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/a9f250886a83082bbc1b926d906712f4f6976c95530b8e2c0e71c3be53693a8b/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f666c6970626f78666163746f72792f706174726f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/flipboxfactory/patron)[![Coverage Status](https://camo.githubusercontent.com/b4a3cb07934292f6facee9f25dcc8d9b97e092aea2f0b379a722f79bbd8966d4/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f666c6970626f78666163746f72792f706174726f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/flipboxfactory/patron/code-structure)[![Quality Score](https://camo.githubusercontent.com/334e7bd6288d19573dca98c4af3aa37f14667af33e762c614896100c8bff27ae/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f666c6970626f78666163746f72792f706174726f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/flipboxfactory/patron)[![Total Downloads](https://camo.githubusercontent.com/10035a78b482f3cc6c92ce1fcd54a69438f97f8d4c9308c9daaabb48a62a96a7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666c6970626f78666163746f72792f706174726f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/flipboxfactory/patron)

Patron is an OAuth2 client manager; Providing an easy to use interface for managing OAuth2 providers and tokens.

[![Screenshot](resources/screenshots/providers.png)](resources/screenshots/providers.png)

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 3.0 or later.

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

[](#installation)

Choose one of the following ways to add [Patron](https://plugins.craftcms.com/patron) to your project:

1. Composer:

    Simply run the following command from your project root:

    ```
    composer require flipboxfactory/patron

    ```
2. Craft CMS Plugin Store:

    Within your Craft CMS project admin panel, navigate to the '[Plugin Store](https://plugins.craftcms.com/patron)' and search for '[Patron](https://plugins.craftcms.com/patron)'. Installation is a button click away.

Once the plugin is included in your project, navigate to the Control Panel, go to Settings → Plugins and click the “Install” button for [Patron](https://plugins.craftcms.com/patron).

Features
--------

[](#features)

[Patron](https://plugins.craftcms.com/patron) provides an Craft CMS admin interface for [The PHP League's OAuth2 client package](https://oauth2-client.thephpleague.com/). Additional features include:

- [Project Config compatible](https://docs.craftcms.com/v3/project-config.html)
- [Provider locking](#provider-locking) (for plugin developers)
- Ships with native providers: Facebook, GitHub, Google, LinkedIn, Instagram
- [Register your own OAuth2 Providers](#third-party-providers)

### Templating

[](#templating)

The `craft.patron` template variable provides access to the entire [Patron](https://plugins.craftcms.com/patron) plugin. However, there are two useful tags worth highlighting:

Retrieving providers:

```
{% set providerQuery = craft.patron.providers %}
{% set provider = providerQuery.handle('providerHandle').one() %}
```

Retrieving tokens:

```
{% set tokenQuery = craft.patron.tokens %}
{% set token = tokenQuery.provider('providerHandle').one() %} {# a token associated to a provider #}
```

### Screenshots

[](#screenshots)

[![Proviers](resources/screenshots/providers.png)](resources/screenshots/providers.png)

[![Update](resources/screenshots/update.png)](resources/screenshots/update.png)

[![Tokens](resources/screenshots/tokens.png)](resources/screenshots/tokens.png)

[![Settings](resources/screenshots/settings.png)](resources/screenshots/settings.png)

---

### Settings

[](#settings)

The settings (including provider configurations) can be overridden with the plugins configuration file: `config/patron.php`

It's recommended that sensitive data (such as the client secret) is accessed via environmental variables:

```
[
    'providerHandle' => [
        'clientId' => getenv('SOME_PROVIDER_CLIENT_ID'),
        'clientSecret' => getenv('SOME_PROVIDER_CLIENT_SECRET'),
    ],
    'anotherProviderHandle' => [
            'clientId' => getenv('SOME_OTHER_PROVIDER_CLIENT_ID'),
            'clientSecret' => getenv('SOME_OTHER_PROVIDER_CLIENT_SECRET'),
        ]
]
```

### Third Party Providers

[](#third-party-providers)

Adding addition providers to [Patron](https://plugins.craftcms.com/patron) is handled through the following events:

1. Register a compatible [The PHP League OAuth2 provider](https://oauth2-client.thephpleague.com/providers/implementing/) using a [fully qualified class name](https://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class). The PHP League has an [extensive list](https://oauth2-client.thephpleague.com/providers/thirdparty/) that have been contributed by the community.

    ```
    \yii\base\Event::on(
        \flipbox\patron\cp\Cp::class,
        \flipbox\patron\events\RegisterProviders::REGISTER_PROVIDERS,
        function (\flipbox\patron\events\RegisterProviders $event) {
            $event->providers[] = '\your\fully\qualified\provider\class\name'; // Ex: \Stevenmaguire\OAuth2\Client\Provider\Salesforce::class
        }
    );
    ```
2. \[Optional\] Register a settings interface for the Provider. If your provider can be configured, the settings interface will enable configuration inputs via the Craft CP. The settings interface will be registered on the same provider class in step 1.

    ```
    \yii\base\Event::on(
        '\your\fully\qualified\provider\class\name', // Ex: \Stevenmaguire\OAuth2\Client\Provider\Salesforce::class
        \flipbox\patron\events\RegisterProviderSettings::REGISTER_SETTINGS,
        function (\flipbox\patron\events\RegisterProviderSettings $event) {
            $event->class = '\your\fully\qualified\settings\class\name';  // Ex: \flipbox\patron\salesforce\settings\SalesforceSettings::class
        }
    );
    ```
3. \[Optional\] Register additional info for the Provider. Throughout the Craft CP we use a provider `name` and `icon`. Register the following in order to specify these values:

    ```
    \yii\base\Event::on(
        \flipbox\patron\cp\Cp::class,
        \flipbox\patron\events\RegisterProviderInfo::REGISTER_INFO,
        function (\flipbox\patron\events\RegisterProviderInfo $event) {
            $event->info['\your\fully\qualified\provider\class\name] = [
                'name' => 'Your Provider',
                'icon' => '/path/to/icon.svg' // Ex: '@vendor/flipboxfactory/patron-salesforce/icons/salesforce.svg'
            ];
        }
    );
    ```

As an example, here are a few third-party provider packages to reference:

- [Salesforce OAuth2 Provider for Patron](https://github.com/flipboxfactory/patron-salesforce)
- [HubSpot OAuth2 Provider for Patron](https://github.com/flipboxfactory/patron-hubspot)

### Provider Locking

[](#provider-locking)

A provider can be 'locked' by a plugin. As a result, only the plugin (that locked it) can delete the provider. This is useful when another plugin is using [Patron](https://plugins.craftcms.com/patron) to manage it's OAuth2 connections, which may not be apparent.

```
```php

/** @var \flipbox\patron\records\Provider $provider */
/** @var \craft\base\PluginInterface $yourPlugin */

$provider->saveAndLock($yourPlugin);

```

```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/flipboxfactory/patron/blob/master/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Flipbox Digital](https://github.com/flipbox)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/flipboxfactory/patron/blob/master/LICENSE) for more information.

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance48

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 94% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~132 days

Recently: every ~458 days

Total

22

Last Release

187d ago

Major Versions

1.0.0.1 → 2.0.02019-01-13

2.4.0 → 3.0.02023-02-14

3.0.0 → 5.0.02025-11-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/f88ef7075dc76a34393f80402c30cc8eec30d5134835314136669a68b8ce817f?d=identicon)[nateiler](/maintainers/nateiler)

---

Top Contributors

[![nateiler](https://avatars.githubusercontent.com/u/1892443?v=4)](https://github.com/nateiler "nateiler (126 commits)")[![dougstjohn](https://avatars.githubusercontent.com/u/3673451?v=4)](https://github.com/dougstjohn "dougstjohn (5 commits)")[![dsmrt](https://avatars.githubusercontent.com/u/1995478?v=4)](https://github.com/dsmrt "dsmrt (2 commits)")[![croxton](https://avatars.githubusercontent.com/u/279127?v=4)](https://github.com/croxton "croxton (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/flipboxfactory-patron/health.svg)

```
[![Health](https://phpackages.com/badges/flipboxfactory-patron/health.svg)](https://phpackages.com/packages/flipboxfactory-patron)
```

###  Alternatives

[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[thenetworg/oauth2-azure

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2509.6M48](/packages/thenetworg-oauth2-azure)[stevenmaguire/oauth2-keycloak

Keycloak OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[axepress/wp-graphql-headless-login

A WordPress plugin that provides headless login and authentication for WPGraphQL

10512.9k](/packages/axepress-wp-graphql-headless-login)[fof/oauth

Allow users to log in with GitHub, Facebook, Google, Discord, GitLab, LinkedIn, and more!

50118.7k41](/packages/fof-oauth)[microsoft/kiota-authentication-phpleague

Authentication provider for Kiota using the PHP League OAuth 2.0 client to authenticate against the Microsoft Identity platform

153.2M7](/packages/microsoft-kiota-authentication-phpleague)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
