PHPackages                             rabbuse/jwt - 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. rabbuse/jwt

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

rabbuse/jwt
===========

my jwt class

1.2.1(5y ago)016MITPHPPHP &gt;=7.0

Since Jul 26Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Rabbuse/jwt)[ Packagist](https://packagist.org/packages/rabbuse/jwt)[ RSS](/packages/rabbuse-jwt/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (4)DependenciesVersions (4)Used By (0)

使用方法

`use Rabbuse\Jwt\JWT;`

获取实例：

`$jwt = JWT::getInstance();`

生成一个jwt串

`$token = $jwt->encode(['1d'], 'key');`

可以通过内置方法设置一些jwt属性

设置jwt的加密类型,默认是HS256。

目前支持类型:

HS256，HS384，HS512

RS256, RS384, RS512

ES256, ES384, ES512

`$jwt->setAlg('HS256');`

设置签发人

`$jwt->setIssuer('rabbuse');`

设置过期时间，需要传入一个到期的时间戳

`$jwt->setExpire(1595603554);`

或者使用setValid方法设置有效时间，需要传入jwt有效的秒数

`$jwt->setExpire(3600);`

设置生效时间，传入一个时间戳，在到达这个时间之前jwt不会生效

`$jwt->setNotBefore(1595603554);`

或者使用setBeforeTime方法设置生效剩余时间，需要传入一个距离生效时间剩余的秒数

`$jwt->setBeforeTime(600);`

还可以使用链式调用批量设置属性，例如设置jwt的发放目标、主题和id编号

`$jwt->setAudience('aud')->setSubject('jwt')->setJwtId('123');`

最后调用encode方法，提供一些需要保存的信息和一个加密秘钥，以生成一个jwt字符串

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Total

3

Last Release

1867d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/36186970?v=4)[Rabbuse](/maintainers/Rabbuse)[@Rabbuse](https://github.com/Rabbuse)

---

Top Contributors

[![Rabbuse](https://avatars.githubusercontent.com/u/36186970?v=4)](https://github.com/Rabbuse "Rabbuse (1 commits)")

### Embed Badge

![Health badge](/badges/rabbuse-jwt/health.svg)

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

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[beatswitch/lock

A flexible, driver based Acl package for PHP 5.4+

870304.7k2](/packages/beatswitch-lock)[amocrm/amocrm-api-library

amoCRM API Client

182728.5k6](/packages/amocrm-amocrm-api-library)[vonage/jwt

A standalone package for creating JWTs for Vonage APIs

424.1M4](/packages/vonage-jwt)

PHPackages © 2026

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