JWT / PHP + Rust

Put JWT authin one core

Issue, verify, refresh and revoke through one core shared by plain PHP and six frameworks.

Kee the key guard, the jwt project pet

Write auth logic once

The core depends on no framework helper; config, logging, database and Redis connections are injected from outside, and the six adapters only wire the container.

All seven integration paths share one config shape; the blacklist switches between file, redis, database and memcached, with fail-open or fail-closed behavior on storage errors.

  • No framework core
  • HS256 to RS256
  • Fail open or closed
7Integration paths
4Storage drivers
276Test cases
Kee the key guard Smile expression

Kee

A flat cartoon Shiba Inu door guard: six gold studs on its collar stand for the six framework adapters, a gold key tag hangs from its neck, and a blue shield sits in the key bow.

Verify every request at the door.

From issue to revoke

One core handles the whole token lifecycle.

Multi-algorithm issuing

HS256, HS384, HS512 and RS256, with time leeway during validation.

Refresh rotation

A refreshed token blacklists the old jti, so refresh tokens cannot be reused.

Four blacklist stores

Switch between file, redis, database and memcached by config.

Native PHP guard

Native\Guard reads the Bearer token and returns a uniform 401 JSON response.

Seven integration paths

Each path has a middleware, filter or request guard.

Retry and failure policy

Storage operations retry automatically; failures can fail open or closed.

Same capability, Rust version

Beyond PHP, the same JWT authentication is available in Rust.

Rust v1.0.3 Rust 1.88 / crate

jwt-rust

Rust multi-framework JWT

JWT core with four algorithms, refresh rotation, four blacklist stores and nine integration paths.

  • Nine integration paths
  • Four blacklist stores
  • Eight framework adapters
View Rust repository

From core to guard expressions

Four key releases that added adapters and the project pet.

v2.2.6

Test assertion fix

Fix the Memcached call-state assertion and rerun tests before release.

v2.2.5

Pet forms in the code API

Wire 12 pet expressions into the Mascot API for direct use in code.

v2.2.4

Mascot and social preview

Finish the flat mascot, full expression set and social preview.

v2.2.0

Yii2 and Yii3 adapters

Add Yii2 and Yii3 adapters and fix a Yii2 dynamic-property auth crash.

Changelog

Recent releases; the full list is on GitHub Releases.

Latest v2.2.6 All versions
v2.2.62026-10-19

Fix the Memcached assertion and rerun tests before release.

v2.2.52026-10-18

Wire pet expressions into the Mascot code API.

v2.2.42026-10-18

Flat cartoon mascot, full expression set and social preview.

v2.2.32026-10-18

Document the key guard Kee mascot profile.

v2.2.22026-10-18

Release the Kee the key guard expression set.

v2.2.12026-10-18

Keep the commercial-use note for visual assets.

Install and use

Install first, then run a minimal example.

PHP >= 8.0Full README
Install
composer require erikwang2013/jwt-webman
Minimal example
require __DIR__ . '/vendor/autoload.php';

use Erikwang2013\Jwt\Native\Guard;

$guard = Guard::fromFile(__DIR__ . '/config/jwt.php');

$payload = $guard->requireAuth();
$userId = $payload['user_id'];

Kee's twelve expressions

On door duty, in twelve moods.

Search this site

Try “upload”, “migration” or “JWT”.