PHPackages                             stuki/oauth2-simple-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. stuki/oauth2-simple-client

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

stuki/oauth2-simple-client
==========================

A simply better OAuth2 Client

0.6.0(11y ago)171[1 PRs](https://github.com/StukiOrg/oauth2-simple-client/pulls)MITPHPPHP &gt;=5.4.0

Since Mar 25Pushed 11y ago1 watchersCompare

[ Source](https://github.com/StukiOrg/oauth2-simple-client)[ Packagist](https://packagist.org/packages/stuki/oauth2-simple-client)[ RSS](/packages/stuki-oauth2-simple-client/feed)WikiDiscussions master Synced 6d ago

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

OAuth2 Simple Client
====================

[](#oauth2-simple-client)

[![Build Status](https://camo.githubusercontent.com/d66a9aa4f0b36f4571cf3f75abaf3d3796d239ae4e327c5e77be9b2437fcc8c2/68747470733a2f2f7472617669732d63692e6f72672f5374756b694f72672f6f61757468322d73696d706c652d636c69656e742e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/StukiOrg/oauth2-simple-client)[![Coverage Status](https://camo.githubusercontent.com/d2290380a76f41f9a857a028f1e8f643512405f28cc1a40fa9c026262c912de0/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f5374756b694f72672f6f61757468322d73696d706c652d636c69656e742f62616467652e706e67)](https://coveralls.io/r/StukiOrg/oauth2-simple-client)[![Total Downloads](https://camo.githubusercontent.com/2adba584ce79964d3a2b27a9517bb19f565f761ac4d3ba3730efcd8874958c5e/68747470733a2f2f706f7365722e707567782e6f72672f7374756b692f6f61757468322d73696d706c652d636c69656e742f646f776e6c6f6164732e706e67)](https://packagist.org/packages/stuki/oauth2-simple-client)

This OAuth2 client is a simply better way to use OAuth2 in your application.

Included Providers
------------------

[](#included-providers)

- Box
- Eventbrite
- Facebook
- Github
- Google
- Instagram
- LinkedIn
- Meetup
- Microsoft

About
-----

[](#about)

This is a hard fork of ThePHPLeague/oauth-client and this is the offical repository for StukiOrg/oauth2-simple-client.

This simple client implements a well architected solution for OAuth2 authentication. Contributions are accepted for new OAuth2 adapters if you choose to share.

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

[](#installation)

```
$ php composer.phar require stuki/oauth2-simple-client dev-master
```

ZF2 Example
-----------

[](#zf2-example)

```
use Stuki\OAuth2\Client;

    public function LoginAction()
    {
        $config = $this->getServiceLocator()->get('Config');

        $provider = new Client\Provider\Meetup(array(
            'clientId' => $config['meetup']['key'],
            'clientSecret' => $config['meetup']['secret'],
            'redirectUri' => $config['meetup']['redirect'],
        ));

        if ( ! $this->params()->fromQuery('code')) {
            // No authorization code; send user to get one
            // Some providers support and/or require an application state token
            return $this->plugin('redirect')->toUrl($provider->getAuthorizationUrl(array('state' => 'token')));
        } else {
            try {
                // Get an authorization token
                $token = $provider->getAccessToken('authorization_code', [
                    'code' => $_GET['code'],
                ]);
            } catch (Client\Exception\IDPException $e) {
                // Handle error from oauth2 server
            }

            // Store the access and refresh token for future use
            $container = new Container('oauth2');
            $container->accessToken = $token->accessToken;
            $container->refreshToken = $token->refreshToken;

            // Redirect to save session
            return $this->plugin('redirect')->toRoute('member');
        }
    }
```

Refresh a Token
---------------

[](#refresh-a-token)

```
use Stuki\OAuth2\Client;

$provider = new Client\Provider\(array(
    'clientId'  =>  'id',
    'clientSecret'  =>  'secret',
    'redirectUri'   =>  'https://your-registered-redirect-uri/'
));

$grant = new Client\Grant\RefreshToken();
$token = $provider->getAccessToken($grant, ['refresh_token' => $refreshToken]);
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~58 days

Total

6

Last Release

4171d ago

Major Versions

0.6.0 → 1.0.x-dev2014-12-15

PHP version history (2 changes)0.1PHP &gt;=5.3.0

0.4.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/49dd7d9dba889ac674b0da447d9c1e69d1128dc3ccbaef98ba83d6ee519fc2d6?d=identicon)[tom\_anderson](/maintainers/tom_anderson)

---

Top Contributors

[![alexbilbie](https://avatars.githubusercontent.com/u/77991?v=4)](https://github.com/alexbilbie "alexbilbie (57 commits)")[![TomHAnderson](https://avatars.githubusercontent.com/u/493920?v=4)](https://github.com/TomHAnderson "TomHAnderson (20 commits)")[![bencorlett](https://avatars.githubusercontent.com/u/181919?v=4)](https://github.com/bencorlett "bencorlett (11 commits)")[![jamesmills](https://avatars.githubusercontent.com/u/557096?v=4)](https://github.com/jamesmills "jamesmills (8 commits)")[![msurguy](https://avatars.githubusercontent.com/u/585833?v=4)](https://github.com/msurguy "msurguy (6 commits)")[![dhrrgn](https://avatars.githubusercontent.com/u/149921?v=4)](https://github.com/dhrrgn "dhrrgn (3 commits)")[![robertpitt](https://avatars.githubusercontent.com/u/567579?v=4)](https://github.com/robertpitt "robertpitt (2 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (1 commits)")[![bitinn](https://avatars.githubusercontent.com/u/1484279?v=4)](https://github.com/bitinn "bitinn (1 commits)")[![PavloPoliakov](https://avatars.githubusercontent.com/u/839290?v=4)](https://github.com/PavloPoliakov "PavloPoliakov (1 commits)")[![pborreli](https://avatars.githubusercontent.com/u/77759?v=4)](https://github.com/pborreli "pborreli (1 commits)")[![sdh100shaun](https://avatars.githubusercontent.com/u/79883?v=4)](https://github.com/sdh100shaun "sdh100shaun (1 commits)")[![suwardany](https://avatars.githubusercontent.com/u/2053770?v=4)](https://github.com/suwardany "suwardany (1 commits)")[![tfountain](https://avatars.githubusercontent.com/u/387569?v=4)](https://github.com/tfountain "tfountain (1 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")[![dragoonis](https://avatars.githubusercontent.com/u/146321?v=4)](https://github.com/dragoonis "dragoonis (1 commits)")[![tomsobpl](https://avatars.githubusercontent.com/u/124267?v=4)](https://github.com/tomsobpl "tomsobpl (1 commits)")[![dwightwatson](https://avatars.githubusercontent.com/u/1100408?v=4)](https://github.com/dwightwatson "dwightwatson (1 commits)")

---

Tags

AuthenticationSSOidentityoauthoauth2authorizationidpsingle sign on

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/stuki-oauth2-simple-client/health.svg)

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

###  Alternatives

[adam-paterson/oauth2-slack

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

22694.8k5](/packages/adam-paterson-oauth2-slack)

PHPackages © 2026

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