PHPackages                             tgallice/oauth2-buffer - 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. tgallice/oauth2-buffer

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

tgallice/oauth2-buffer
======================

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

v0.1.0(10y ago)02572[1 issues](https://github.com/tgallice/oauth2-buffer/issues)MITPHPPHP &gt;=5.5.0

Since Mar 10Pushed 10y ago1 watchersCompare

[ Source](https://github.com/tgallice/oauth2-buffer)[ Packagist](https://packagist.org/packages/tgallice/oauth2-buffer)[ RSS](/packages/tgallice-oauth2-buffer/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Buffer Provider for OAuth 2.0 Client
====================================

[](#buffer-provider-for-oauth-20-client)

This package provides Buffer OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).

[![Build Status](https://camo.githubusercontent.com/b593ef31d057138292ffd5149e2d89fe59f6857f5c64610e1b1d78098ad1e3dd/68747470733a2f2f7472617669732d63692e6f72672f7467616c6c6963652f6f61757468322d6275666665722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/tgallice/oauth2-buffer)[![Code Coverage](https://camo.githubusercontent.com/d4dd1b36bf78171d6998a4b180abcfc9561c953758787d5ad134b3ebad1e62d0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7467616c6c6963652f6f61757468322d6275666665722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/tgallice/oauth2-buffer/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d1c948f1b8dab58198d560ac45cd314ea497dddb83670e03ca0702ea82f5d105/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7467616c6c6963652f6f61757468322d6275666665722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/tgallice/oauth2-buffer/?branch=master)

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

[](#installation)

To install, use composer:

```
composer require tgallice/oauth2-buffer

```

Usage
-----

[](#usage)

Usage is the same as The League's OAuth client, using `\Tgallice\OAuth2\Client\Provider\Buffer` as the provider.

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new Tgallice\OAuth2\Client\Provider\Buffer([
    'clientId'          => '{buffer-client-id}',
    'clientSecret'      => '{buffer-client-secret}',
    'redirectUri'       => 'https://example.com/callback-url',
]);

if (!isset($_GET['code'])) {

    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl();
    $_SESSION['oauth2state'] = $provider->getState();
    header('Location: '.$authUrl);
    exit;

// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {

    unset($_SESSION['oauth2state']);
    exit('Invalid state');

} else {

    // Try to get an access token (using the authorization code grant)
    $token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code']
    ]);

    // Optional: Now you have a token you can look up a users profile data
    try {

        // We got an access token, let's now get the user's details
        $user = $provider->getResourceOwner($token);

        // Use these details to create a new profile
        printf('Hello %s!', $user->getName());

    } catch (Exception $e) {

        // Failed to get user details
        exit('Oh dear...');
    }

    // Use this to interact with an API on the users behalf
    echo $token->getToken();
}
```

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/tgallice/oauth2-buffer/blob/master/LICENSE) for more information.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

3764d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6c17b24f359a7df6f9d2bf980a4827443c71a3273c4d5a45db11001fa6cd5d2d?d=identicon)[tgallice](/maintainers/tgallice)

---

Top Contributors

[![tgallice](https://avatars.githubusercontent.com/u/860533?v=4)](https://github.com/tgallice "tgallice (5 commits)")

---

Tags

clientoauthoauth2authorizationauthorisationBuffer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tgallice-oauth2-buffer/health.svg)

```
[![Health](https://phpackages.com/badges/tgallice-oauth2-buffer/health.svg)](https://phpackages.com/packages/tgallice-oauth2-buffer)
```

###  Alternatives

[stevenmaguire/oauth2-keycloak

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

2276.2M36](/packages/stevenmaguire-oauth2-keycloak)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1152.7M11](/packages/patrickbussmann-oauth2-apple)[omines/oauth2-gitlab

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

36761.9k15](/packages/omines-oauth2-gitlab)[league/oauth2-instagram

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

661.1M43](/packages/league-oauth2-instagram)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

261.8M1](/packages/mollie-oauth2-mollie-php)[dalpras/oauth2-gotowebinar

LogMeIn GoToWebinar OAuth 2.0 Client Provider for the PHP League's OAuth 2.0 Client

1245.5k](/packages/dalpras-oauth2-gotowebinar)

PHPackages © 2026

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