PHPackages                             mobilejazz/yii2-oauth2-server - 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. mobilejazz/yii2-oauth2-server

AbandonedArchivedYii2-extension[Authentication &amp; Authorization](/categories/authentication)

mobilejazz/yii2-oauth2-server
=============================

OAuth2 Server for PHP

2.1.0(9y ago)011.0k1MITPHP

Since Mar 26Pushed 8y ago1 watchersCompare

[ Source](https://github.com/mobilejazz-contrib/yii2-oauth2-server)[ Packagist](https://packagist.org/packages/mobilejazz/yii2-oauth2-server)[ Docs](https://github.com/mobilejazz/yii2-oauth2-server)[ RSS](/packages/mobilejazz-yii2-oauth2-server/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (7)Dependencies (2)Versions (9)Used By (0)

yii2-oauth2-server
==================

[](#yii2-oauth2-server)

A wrapper for implementing an OAuth2 Server()

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist mobilejazz/yii2-oauth2-server "*"

```

or add

```
"mobilejazz/yii2-oauth2-server": "~2.1"
```

to the require section of your composer.json.

To use this extension, simply add the following code in your application configuration:

```
'oauth2' => [
    'class' => 'mobilejazz\yii2\oauth2server\Module',
    'tokenParamName' => 'accessToken',
    'tokenAccessLifetime' => 3600 * 24,
    'storageMap' => [
        'user_credentials' => 'common\models\User',
    ],
    'grantTypes' => [
        'user_credentials' => [
            'class' => 'OAuth2\GrantType\UserCredentials',
        ],
        'refresh_token' => [
            'class' => 'OAuth2\GrantType\RefreshToken',
            'always_issue_new_refresh_token' => true
        ]
    ]
]
```

`common\models\User` - user model implementing an interface `\OAuth2\Storage\UserCredentialsInterface`, so the oauth2 credentials data stored in user table

The next step your shold run migration

```
yii migrate --migrationPath=@vendor/mobilejazz/yii2-oauth2-server/migrations
```

this migration create the oauth2 database scheme and insert test user credentials `testclient:testpass` for `http://fake/`

add url rule to urlManager

```
'urlManager' => [
    'rules' => [
        'POST oauth2/' => 'oauth2/default/',
        ...
    ]
]
```

Usage
-----

[](#usage)

To use this extension, simply add the behaviors for your base controller:

```
use yii\helpers\ArrayHelper;
use yii\filters\auth\HttpBearerAuth;
use yii\filters\auth\QueryParamAuth;
use mobilejazz\yii2\oauth2server\filters\ErrorToExceptionFilter;
use mobilejazz\yii2\oauth2server\filters\auth\CompositeAuth;

class Controller extends \yii\rest\Controller
{
    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return ArrayHelper::merge(parent::behaviors(), [
            'authenticator' => [
                'class' => CompositeAuth::className(),
                'authMethods' => [
                    ['class' => HttpBearerAuth::className()],
                    ['class' => QueryParamAuth::className(), 'tokenParam' => 'accessToken'],
                ]
            ],
            'exceptionFilter' => [
                'class' => ErrorToExceptionFilter::className()
            ],
        ]);
    }
}
```

For more, see

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 53.1% 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 ~128 days

Recently: every ~192 days

Total

7

Last Release

3295d ago

Major Versions

v1.0 → 2.0.02015-07-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/6a6b341883d9dc01ecbf995db1379229536eddf64ea8f75121e088bacc70ee50?d=identicon)[Alex-DA](/maintainers/Alex-DA)

---

Top Contributors

[![filsh](https://avatars.githubusercontent.com/u/6173680?v=4)](https://github.com/filsh "filsh (26 commits)")[![rollwhistler](https://avatars.githubusercontent.com/u/4394800?v=4)](https://github.com/rollwhistler "rollwhistler (5 commits)")[![ventayol](https://avatars.githubusercontent.com/u/1505998?v=4)](https://github.com/ventayol "ventayol (5 commits)")[![brianmcgee](https://avatars.githubusercontent.com/u/1173648?v=4)](https://github.com/brianmcgee "brianmcgee (4 commits)")[![viktorprogger](https://avatars.githubusercontent.com/u/7670669?v=4)](https://github.com/viktorprogger "viktorprogger (3 commits)")[![freezy-sk](https://avatars.githubusercontent.com/u/661637?v=4)](https://github.com/freezy-sk "freezy-sk (2 commits)")[![hiqsol](https://avatars.githubusercontent.com/u/11820365?v=4)](https://github.com/hiqsol "hiqsol (1 commits)")[![RoyXiang](https://avatars.githubusercontent.com/u/1772811?v=4)](https://github.com/RoyXiang "RoyXiang (1 commits)")[![shcherbanich](https://avatars.githubusercontent.com/u/3122336?v=4)](https://github.com/shcherbanich "shcherbanich (1 commits)")[![Dareen](https://avatars.githubusercontent.com/u/5462442?v=4)](https://github.com/Dareen "Dareen (1 commits)")

---

Tags

extensionwidgetyii

### Embed Badge

![Health badge](/badges/mobilejazz-yii2-oauth2-server/health.svg)

```
[![Health](https://phpackages.com/badges/mobilejazz-yii2-oauth2-server/health.svg)](https://phpackages.com/packages/mobilejazz-yii2-oauth2-server)
```

###  Alternatives

[filsh/yii2-oauth2-server

OAuth2 Server for PHP

331523.9k12](/packages/filsh-yii2-oauth2-server)

PHPackages © 2026

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