PHPackages                             sergeymakinen/yii2-jwt-user - 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. sergeymakinen/yii2-jwt-user

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

sergeymakinen/yii2-jwt-user
===========================

JWT (JSON Web Token) User component for Yii 2

v3.0.0(9y ago)165524MITPHPPHP ^5.5 || ^7.0

Since Aug 7Pushed 6y ago1 watchersCompare

[ Source](https://github.com/sergeymakinen/yii2-jwt-user)[ Packagist](https://packagist.org/packages/sergeymakinen/yii2-jwt-user)[ Docs](https://github.com/sergeymakinen/yii2-jwt-user)[ RSS](/packages/sergeymakinen-yii2-jwt-user/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (8)Dependencies (4)Versions (8)Used By (0)

JWT powered User for Yii 2
==========================

[](#jwt-powered-user-for-yii-2)

JWT ([JSON Web Token](https://jwt.io)) based Yii 2 [User](http://www.yiiframework.com/doc-2.0/yii-web-user.html) component drop-in replacement.

[![Code Quality](https://camo.githubusercontent.com/16c65f21acfbb367c38e0aee36bd4d22cc3bfe0b334aba98fc29c9c6e2c7e7de/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7365726765796d616b696e656e2f796969322d6a77742d757365722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/sergeymakinen/yii2-jwt-user) [![Build Status](https://camo.githubusercontent.com/8a1d021cdac407d4f5163f3fa622cb8a008e5e32422c249df18f973d48789267/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7365726765796d616b696e656e2f796969322d6a77742d757365722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/sergeymakinen/yii2-jwt-user) [![Code Coverage](https://camo.githubusercontent.com/215461bf189a07276e2b364c1418017fa331622db46225fd35d1bbb1c889f419/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f7365726765796d616b696e656e2f796969322d6a77742d757365722e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/sergeymakinen/yii2-jwt-user) [![SensioLabsInsight](https://camo.githubusercontent.com/bb561ca7f591278fa064b1d8b84fbaed8c3f7f47231f95bc7fc03b75ca6d601d/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f65646164663937662d393562612d343939382d623833322d6564333063613665313031342e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/edadf97f-95ba-4998-b832-ed30ca6e1014)

[![Packagist Version](https://camo.githubusercontent.com/3ba08d5c3af8d2a46d00de09dc4f37d6923bd7a3a9ef2e6781d9a7eaac7c1130/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7365726765796d616b696e656e2f796969322d6a77742d757365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sergeymakinen/yii2-jwt-user) [![Total Downloads](https://camo.githubusercontent.com/b7e41f266bbea2ae1e68605b8450b17d50b6ff47f707ce0c20d504091b09956a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7365726765796d616b696e656e2f796969322d6a77742d757365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sergeymakinen/yii2-jwt-user) [![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

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

[](#installation)

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

Either run

```
composer require "sergeymakinen/yii2-jwt-user:^3.0"
```

or add

```
"sergeymakinen/yii2-jwt-user": "^3.0"
```

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

Usage
-----

[](#usage)

Set the following Yii 2 configuration parameters:

```
[
    'components' => [
        'user' => [
            'class' => 'sergeymakinen\yii\jwtuser\User',
            'identityClass' => 'app\models\User',
            'enableAutoLogin' => true, // Optional
            'key' => 'random sign key (CHANGE IT!)',
        ],
    ],
]
```

Also set `identityClass` to whatever your identity class name is.

**Don't forget**: set `key` to some *random* value and make sure it's *secret* and long enough.

Configuration
-------------

[](#configuration)

You can choose between 3 different modes of sign key generation:

`$useAuthKey` value`$appendAuthKey` valueResulting key`false``false``sergeymakinen\yii\jwtuser\User::$key``true``false``yii\web\IdentityInterface::getAuthKey()``true``true``sergeymakinen\yii\jwtuser\User::$key`
concatenated with
`yii\web\IdentityInterface::getAuthKey()`Your choice depends on how you're going to use identities, revoke old/compromised keys.

It's also possible to specify "audience" and "issuer" claims (and validate against them) via corresponding `$audience` and `$issuer` properties. They both may be either strings or `Closure` returning a string.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Total

7

Last Release

3342d ago

Major Versions

v1.1.1 → v2.0.02017-01-06

v2.0.0 → v3.0.02017-05-03

PHP version history (2 changes)v1.1.1PHP &gt;=5.5

v3.0.0PHP ^5.5 || ^7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/983964?v=4)[Sergey Makinen](/maintainers/sergeymakinen)[@sergeymakinen](https://github.com/sergeymakinen)

---

Top Contributors

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

---

Tags

authauthenticationjsonjwtphpphp-librarytokenuserwebyii2yii2-extensionjwtjsonwebtokenJSON Web Tokenuseryii2yiiyii2-jwt-user

### Embed Badge

![Health badge](/badges/sergeymakinen-yii2-jwt-user/health.svg)

```
[![Health](https://phpackages.com/badges/sergeymakinen-yii2-jwt-user/health.svg)](https://phpackages.com/packages/sergeymakinen-yii2-jwt-user)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k102.0M102](/packages/namshi-jose)[psecio/jwt

A JWT (JSON Web Token) Encoding &amp; Decoding library

109359.4k2](/packages/psecio-jwt)[bizley/jwt

JWT integration for Yii 2

69461.3k2](/packages/bizley-jwt)[amnah/yii2-user

Yii 2 user authentication module

257231.0k3](/packages/amnah-yii2-user)[2amigos/yii2-usuario

Highly customizable and extensible user management, authentication, and authorization Yii2 extension

294282.0k15](/packages/2amigos-yii2-usuario)[sop/jwx

A PHP library for JSON web tokens (JWT) with signature (JWS) and encryption (JWE) support.

25278.4k1](/packages/sop-jwx)

PHPackages © 2026

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