PHPackages                             most-significant-bit/oauth2-client - 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. most-significant-bit/oauth2-client

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

most-significant-bit/oauth2-client
==================================

OAuth 2.0 Client. Implement RFC 6749.

0.3.0(10y ago)23.3k2BSD-3-ClausePHPPHP &gt;=5.3.3

Since Mar 4Pushed 9y ago2 watchersCompare

[ Source](https://github.com/michalkopacz/oauth2-client)[ Packagist](https://packagist.org/packages/most-significant-bit/oauth2-client)[ RSS](/packages/most-significant-bit-oauth2-client/feed)WikiDiscussions develop Synced today

READMEChangelogDependencies (12)Versions (7)Used By (0)

[![Build Status](https://camo.githubusercontent.com/9d8365c8a635b694d5f2177a313e1212cda47968449499f2f0cfaff31a6b924b/68747470733a2f2f7472617669732d63692e6f72672f6d696368616c6b6f7061637a2f6f61757468322d636c69656e742e7376673f6272616e63683d646576656c6f70)](https://travis-ci.org/michalkopacz/oauth2-client)

Usage
=====

[](#usage)

```
use MostSignificantBit\OAuth2\Client\Client as OAuth2Client;
use MostSignificantBit\OAuth2\Client\Config\Config;
use MostSignificantBit\OAuth2\Client\AccessToken\SuccessfulResponse as AccessTokenSuccessfulResponse;
use MostSignificantBit\OAuth2\Client\Grant\ResourceOwnerPasswordCredentials\AccessTokenRequest;
use MostSignificantBit\OAuth2\Client\Grant\ResourceOwnerPasswordCredentials\ResourceOwnerPasswordCredentialsGrant;
use MostSignificantBit\OAuth2\Client\Parameter\AccessToken;
use MostSignificantBit\OAuth2\Client\Parameter\ExpiresIn;
use MostSignificantBit\OAuth2\Client\Parameter\Password;
use MostSignificantBit\OAuth2\Client\Parameter\RefreshToken;
use MostSignificantBit\OAuth2\Client\Parameter\TokenType;
use MostSignificantBit\OAuth2\Client\Parameter\Username;

$config = new Config(array(
    'endpoint' => array(
        'token_endpoint_uri' => 'http://127.0.0.1:8000/oauth2/token',
    ),
    'client' => array(
        'credentials' => array(
            'client_id' => 's6BhdRkqt3',
            'client_secret' => '7Fjfp0ZBr1KtDRbnfVdmIw',
        ),
    ),
));

$oauth2Client = new OAuth2Client($config);

$accessTokenRequest = new AccessTokenRequest(new Username('johndoe'), new Password('A3ddj3w'));

$grant = new ResourceOwnerPasswordCredentialsGrant($accessTokenRequest);

try {
    $accessTokenResponse = $oauth2Client->obtainAccessToken($grant);
} catch (TokenException $exception) {
    //log exception
}
```

Contribution
============

[](#contribution)

Testing
-------

[](#testing)

OAuth2 Client library has wrote unit and integration tests. We use phpunit for both of them.

### Run all tests

[](#run-all-tests)

```
vendor/bin/phpunit
```

### Run only unit tests

[](#run-only-unit-tests)

```
vendor/bin/phpunit --group unit
```

### Run only integration tests

[](#run-only-integration-tests)

```
vendor/bin/phpunit --group integration
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

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 ~61 days

Total

5

Last Release

3895d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/194026?v=4)[Michał Kopacz](/maintainers/michalkopacz)[@michalkopacz](https://github.com/michalkopacz)

---

Top Contributors

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

---

Tags

phpclientoauthoauth2oauth 2.0

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/most-significant-bit-oauth2-client/health.svg)

```
[![Health](https://phpackages.com/badges/most-significant-bit-oauth2-client/health.svg)](https://phpackages.com/packages/most-significant-bit-oauth2-client)
```

###  Alternatives

[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

261.8M1](/packages/mollie-oauth2-mollie-php)[andalisolutions/oauth2-anaf

Anaf OAuth 2.0 support for the PHP League's OAuth 2.0 Client

196.6k](/packages/andalisolutions-oauth2-anaf)

PHPackages © 2026

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