PHPackages                             wolfpack-it/yii2-oauth - 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. wolfpack-it/yii2-oauth

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

wolfpack-it/yii2-oauth
======================

Yii2 OAuth2 server implementation of https://oauth2.thephpleague.com/

v2.2.0(2y ago)19672MITPHPPHP ^8.1

Since Dec 4Pushed 2y ago5 watchersCompare

[ Source](https://github.com/wolfpack-it/yii2-oauth)[ Packagist](https://packagist.org/packages/wolfpack-it/yii2-oauth)[ RSS](/packages/wolfpack-it-yii2-oauth/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (10)Versions (14)Used By (0)

OAuth2 Server module for Yii2
=============================

[](#oauth2-server-module-for-yii2)

This extension provides [The PHP League: OAuth 2.0 Server](https://oauth2.thephpleague.com/) module for the Yii2 Framework.

[The PHP League: OAuth 2.0 Server](https://oauth2.thephpleague.com/) is a package that makes setting up a OAuth2 server easy.

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

[](#installation)

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

Either run

```
$ composer require wolfpack-it/yii2-oauth
```

or add

```
"wolfpack-it/yii2-oauth": "^"

```

to the `require` section of your `composer.json` file.

Configuring
-----------

[](#configuring)

### Configure module

[](#configure-module)

The basic configuration is a module in your application:

```
'modules' => [
    'oauth' => [
        'class' => \WolfpackIT\oauth\Module::class,
        'userClass' => '',
        'db' => 'db', // component that should be used for the database connection
        'publicKey' => '',
        'privateKey' => '',
        'encryptionKey' => '',
        'tokenValidationLeeway' => null|int, // The number of seconds to use as leeway when validating access tokens
    ]
]
```

See the public variables of the [Module](https://github.com/wolfpack-it/yii2-oauth/blob/master/src/Module.php) for the full configuration options.

An example on how to generate keys can be found [here](https://oauth2.thephpleague.com/installation/).

Whenever the `AccessTokenService` is being injected via DI, the module needs to be added to the bootstrap of the application.

### Running migrations

[](#running-migrations)

The migrations can be ran automatically by adding them to the [migration namespaces](https://www.yiiframework.com/doc/guide/2.0/en/db-migrations#namespaced-migrations):

```
'migrationNamespaces' => [
    'WolfpackIT\oauth\migrations',
    'console\migrations',
]
```

To get this working, you will need to add an alias:

```
'aliases' => [
    '@WolfpackIT/oauth' => '@vendor/wolfpack-it/yii2-oauth/src',
]
```

If you want to override the database connection in the migrations, you will need to bootstrap the oauth module also in the console.

### Add routes

[](#add-routes)

To have the module accessible, make sure the correct routes are set in your urlManager.

For example when your module is called `oauth`:

```
'urlManager' => [
    'rules' => [
        'oauth//' => 'oauth//'
    ]
]
```

TODO
----

[](#todo)

- Add tests

Credits
-------

[](#credits)

- [Joey Claessen](https://github.com/joester89)
- [Wolfpack IT](https://github.com/wolfpack-it)

License
-------

[](#license)

The MIT License (MIT). Please see [LICENSE](https://github.com/wolfpack-it/yii2-oauth/blob/master/LICENSE) for more information.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 68.8% 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 ~157 days

Recently: every ~68 days

Total

11

Last Release

835d ago

Major Versions

v1.0.3 → v2.0.02023-06-19

PHP version history (2 changes)v1.0.0PHP &gt;=7.1.0

v2.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/609e8d7caaa1dacc8b03bcc8347b5732e5a91399bb843e5b44fec66be256f35a?d=identicon)[pascalvgemert](/maintainers/pascalvgemert)

![](https://www.gravatar.com/avatar/88359ebe0456645a614e563dfbf0dd025b69ef57221050cb9eb31e3eef4dd0f9?d=identicon)[joester89](/maintainers/joester89)

![](https://www.gravatar.com/avatar/50236d89a220d6eda49f2a6c5a66779f084660c2596ef2c40225b89c4f276efb?d=identicon)[Kavantix](/maintainers/Kavantix)

---

Top Contributors

[![joester89](https://avatars.githubusercontent.com/u/9624366?v=4)](https://github.com/joester89 "joester89 (22 commits)")[![StefanLuijtenWolfpack](https://avatars.githubusercontent.com/u/99487019?v=4)](https://github.com/StefanLuijtenWolfpack "StefanLuijtenWolfpack (5 commits)")[![robjanssen](https://avatars.githubusercontent.com/u/6482836?v=4)](https://github.com/robjanssen "robjanssen (3 commits)")[![dimitar-petro-v](https://avatars.githubusercontent.com/u/144362796?v=4)](https://github.com/dimitar-petro-v "dimitar-petro-v (1 commits)")[![Kavantix](https://avatars.githubusercontent.com/u/6243755?v=4)](https://github.com/Kavantix "Kavantix (1 commits)")

### Embed Badge

![Health badge](/badges/wolfpack-it-yii2-oauth/health.svg)

```
[![Health](https://phpackages.com/badges/wolfpack-it-yii2-oauth/health.svg)](https://phpackages.com/packages/wolfpack-it-yii2-oauth)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.1k17.8k](/packages/prestashop-prestashop)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[jeremy379/laravel-openid-connect

OpenID Connect support to the PHP League's OAuth2 Server. Compatible with Laravel Passport.

59437.0k9](/packages/jeremy379-laravel-openid-connect)[simplesamlphp/simplesamlphp-module-oidc

A SimpleSAMLphp module adding support for the OpenID Connect protocol

5018.2k1](/packages/simplesamlphp-simplesamlphp-module-oidc)

PHPackages © 2026

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