PHPackages                             yusefauto1/guzzle-oauth2-plugin-compat - 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. yusefauto1/guzzle-oauth2-plugin-compat

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

yusefauto1/guzzle-oauth2-plugin-compat
======================================

An OAuth2 plugin for guzzle

1.0.2(6y ago)0125MITPHP

Since Mar 11Pushed 6y ago1 watchersCompare

[ Source](https://github.com/yusefauto1/guzzle-oauth2-plugin)[ Packagist](https://packagist.org/packages/yusefauto1/guzzle-oauth2-plugin-compat)[ RSS](/packages/yusefauto1-guzzle-oauth2-plugin-compat/feed)WikiDiscussions master Synced yesterday

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

guzzle-oauth2-plugin
====================

[](#guzzle-oauth2-plugin)

Provides an OAuth2 plugin for [Guzzle](http://guzzlephp.org/).

Features
--------

[](#features)

- Acquires access tokens via one of the supported grant types (code, client credentials, user credentials, refresh token). Or you can set an access token yourself.
- Supports refresh tokens (stores them and uses them to get new access tokens).
- Handles token expiration (acquires new tokens and retries failed requests).

Ways to use it:

Just set an access token and make a request.

```
use Guzzle\Http\Client;
use CommerceGuys\Guzzle\Plugin\Oauth2\Oauth2Plugin;

$accessToken = array(
  'access_token' => 'e72758a43e1646969f9f7bd7737d0cd637ed17ae',
  'expires' => '1391617481', // Optional.
);
$oauth2Plugin = new Oauth2Plugin();
$oauth2Plugin->setAccessToken($accessToken);

$client = new Client('https://mysite.com/api');
$client->addSubscriber($oauth2Plugin);
$request = $client->get('me');
```

Or use a grant type. Optionally, add a refresh token grant type, used to refresh expired access tokens.

```
use Guzzle\Http\Client;
use CommerceGuys\Guzzle\Plugin\Oauth2\Oauth2Plugin;
use CommerceGuys\Guzzle\Plugin\Oauth2\GrantType\PasswordCredentials;
use CommerceGuys\Guzzle\Plugin\Oauth2\GrantType\RefreshToken;

$oauth2Client = new Client('https://mysite.com/oauth2/token');
$config = array(
    'username' => 'myusername',
    'password' => 'mypassword',
    'client_id' => 'myclient',
    'client_secret' => 'mysecret',
    'scope' => 'administration', // Optional.
);
$grantType = new PasswordCredentials($oauth2Client, $config);
$refreshTokenGrantType = new RefreshToken($oauth2Client, $config);
$oauth2Plugin = new Oauth2Plugin($grantType, $refreshTokenGrantType);

$client = new Client('https://mysite.com/api');
$client->addSubscriber($oauth2Plugin);
$request = $client->get('me');
// $oauth2Plugin->getAccessToken() and $oauth2Plugin->getRefreshToken() can be
// used to export the tokens so that they can be persisted for next time.
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Every ~0 days

Total

2

Last Release

2253d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/60728f07226bb4d84565912a54014fd8733d6611b027fee79ec1bde2699f5ffa?d=identicon)[yusefauto1](/maintainers/yusefauto1)

---

Top Contributors

[![yusefauto1](https://avatars.githubusercontent.com/u/53563897?v=4)](https://github.com/yusefauto1 "yusefauto1 (2 commits)")

### Embed Badge

![Health badge](/badges/yusefauto1-guzzle-oauth2-plugin-compat/health.svg)

```
[![Health](https://phpackages.com/badges/yusefauto1-guzzle-oauth2-plugin-compat/health.svg)](https://phpackages.com/packages/yusefauto1-guzzle-oauth2-plugin-compat)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

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

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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