PHPackages                             zotenme/hyperf-jwt-auth - 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. zotenme/hyperf-jwt-auth

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

zotenme/hyperf-jwt-auth
=======================

JWT Authentication package for Hyperf framework

v2.0.0(1w ago)3946MITPHPPHP &gt;=8.3

Since Jul 29Pushed 12mo agoCompare

[ Source](https://github.com/Zotenme/hyperf-jwt-auth)[ Packagist](https://packagist.org/packages/zotenme/hyperf-jwt-auth)[ RSS](/packages/zotenme-hyperf-jwt-auth/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (5)Dependencies (15)Versions (7)Used By (0)

Hyperf JWT Authentication
=========================

[](#hyperf-jwt-authentication)

[![PHP Version](https://camo.githubusercontent.com/5c8ce4571ddf4b6b8ca847e0c4c079de98fc6460eb7eae9c81ca63319c21f546/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e332d626c75652e737667)](https://php.net/)[![Hyperf Version](https://camo.githubusercontent.com/77f167c25b07bf531eb404fd9859135155f910f92d65de7984c2aa39dd74b202/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6879706572662d253545332e322d677265656e2e737667)](https://hyperf.io/)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![CI](https://github.com/Zotenme/hyperf-jwt-auth/actions/workflows/ci.yml/badge.svg)](https://github.com/Zotenme/hyperf-jwt-auth/actions/workflows/ci.yml)

JWT authentication for Hyperf 3.2+ with refresh-token rotation, revocation, single-session mode and symmetric or asymmetric signing.

Features
--------

[](#features)

- 🔐 **Multiple Algorithm Support** - HS256, HS384, HS512, RS256, RS384, RS512, ES256, ES384, ES512
- 🔄 **Atomic Token Rotation** - A Redis-backed refresh token can be consumed only once
- 🚫 **Token Blacklisting** - Revoke tokens before expiration with grace period support
- 👤 **Single Session (SSO)** - A new login invalidates the subject's previous tokens
- ⚡ **Hyperf 3.2 Cache Integration** - Uses the configured default or named cache store
- 🛡️ **Type Safe** - Full PHP 8.3+ type declarations with PHPStan level 8

Quick Start
-----------

[](#quick-start)

### Installation

[](#installation)

```
composer require zotenme/hyperf-jwt-auth
composer require hyperf/redis:^3.2 # required by refresh rotation
php bin/hyperf.php vendor:publish zotenme/hyperf-jwt-auth
```

### Basic Usage

[](#basic-usage)

```
