PHPackages                             thamtech/yii2-jws - 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. thamtech/yii2-jws

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

thamtech/yii2-jws
=================

JWS Token Manager

v1.1(8y ago)0363Apache-2.0PHPPHP &gt;=5.6.0

Since Oct 6Pushed 5y ago1 watchersCompare

[ Source](https://github.com/thamtech/yii2-jws)[ Packagist](https://packagist.org/packages/thamtech/yii2-jws)[ RSS](/packages/thamtech-yii2-jws/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

yii2-jws
========

[](#yii2-jws)

An extension to manage signed JWS tokens

This library interfaces with [namshi/jose](https://github.com/namshi/jose) to generate signed [JWS](https://tools.ietf.org/html/rfc7515) tokens.

For license information check the [LICENSE](LICENSE.md)-file.

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist thamtech/yii2-jws

```

or add

```
"thamtech/yii2-jws": "*"

```

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

Integration
-----------

[](#integration)

1. [Generate a kepair using OpenSSL](https://en.wikibooks.org/wiki/Cryptography/Generate_a_keypair_using_OpenSSL)and store the keys in public.pem and private.pem.
2. Add the JwsManager application component in your site configuration:

    ```
    return [
      'components' => [
        'jwsManager' => [
          'class' => 'thamtech\jws\components\JwsManager',
          'pubkey' => '@app/config/keys/jws/public.pem',
          'pvtkey' => '@app/config/keys/jws/private.pem',

          // The settings below are optional. Defaults will be used if not set here.
          //'encoder' => 'Namshi\JOSE\Base64\Base64UrlSafeEncoder',
          //'exp' => '1 hour',
          //'alg' => 'RS256',
          //'jwsClass' => 'Namshi\JOSE\SimpleJWS',
        ],
      ]
    ]
    ```

Usage
-----

[](#usage)

Generate a new token:

```
$payload = [
  "user_id": 23,
  "foo": "bar",
];
$tokenString = Yii::$app->jwsManager->newToken($payload);
```

Verify that this string is a token that we signed:

```
$token = Yii::$app->jwsManager->load($tokenString);
$result = Yii::$app->jwsManager->verify($token);
```

Verify that this string is a token that we signed AND (if it is an instance of `\Namshi\JOSE\SimpleJWS` wih an expiration) that it is not expired:

```
$token = Yii::$app->jwsManager->load($tokenString);
$result = Yii::$app->jwsManager->isValid($token);
```

See Also
--------

[](#see-also)

- [cranetm/yii2-json-rpc-2.0](https://github.com/cranetm/yii2-json-rpc-2.0) - Yii 2 extension that helps turn your Controllers into JSON RPC 2.0 APIs.
- [namshi/jose](https://github.com/namshi/jose) - PHP implementation of the JWS (JSON Web Signature) specification.
- [JSON Web Token (JWT)](https://tools.ietf.org/html/rfc7519) - JWT specifications
- [JSON Web Signature (JWS)](https://tools.ietf.org/html/rfc7515) - JWS specifications
- [thamtech/yii2-jsonrpc-jwsauth](https://github.com/thamtech/yii2-jsonrpc-jwsauth)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Total

2

Last Release

2957d ago

PHP version history (2 changes)v1.0PHP &gt;=5.4.0

v1.1PHP &gt;=5.6.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2757540?v=4)[Tyler Ham](/maintainers/tyler-ham)[@tyler-ham](https://github.com/tyler-ham)

---

Top Contributors

[![tyler-ham](https://avatars.githubusercontent.com/u/2757540?v=4)](https://github.com/tyler-ham "tyler-ham (12 commits)")

---

Tags

jwtjsonJWSJOSEauthtokenyii2yii

### Embed Badge

![Health badge](/badges/thamtech-yii2-jws/health.svg)

```
[![Health](https://phpackages.com/badges/thamtech-yii2-jws/health.svg)](https://phpackages.com/packages/thamtech-yii2-jws)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[bizley/jwt

JWT integration for Yii 2

67425.3k2](/packages/bizley-jwt)[sop/jwx

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

26257.5k1](/packages/sop-jwx)[amnah/yii2-user

Yii 2 user authentication module

252225.7k3](/packages/amnah-yii2-user)[kakadu-dev/yii2-jwt-auth

Extension provide JWT auth for Yii2

105.8k](/packages/kakadu-dev-yii2-jwt-auth)[omnilight/yii2-tokens

Provides classes for token validations for Yii2 framework

105.0k](/packages/omnilight-yii2-tokens)

PHPackages © 2026

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