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

ActiveLibrary

bonza/jwt
=========

支持PHP7.0语法，易扩展的jwt-token类库

v1.0.4(6y ago)0933MITPHPPHP &gt;=7.2.0

Since Apr 29Pushed 5y agoCompare

[ Source](https://github.com/bonzaphp/jwt)[ Packagist](https://packagist.org/packages/bonza/jwt)[ RSS](/packages/bonza-jwt/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (7)Used By (0)

php-jwt
=======

[](#php-jwt)

---

安装
--

[](#安装)

```
composer require bonza/jwt

```

使用
--

[](#使用)

1. 首先引入具体实现`use bonza\jwt\JWTHash256;`
2. 配置必要的参数

```
$header = [
    'alg' => 'sha256',//算法
    'typ' => 'JWT',
];
$payload = [
    "iss" => "https://example.cn",//issuer 签发人
    "aud" => "https://example.cn",//audience 受众
    "iat" => time(),//Issued At 签发时间
    "sub" => 'self sign',//subject 主题
    "nbf" => time(),//Not Before 生效时间
    "exp" => time()+3600,//过期时间
    "jti" => 'exp'.date('YmdHis').random_int(1000,9999),//JWT ID
];

```

3. 应用

```
$key = 'jwt-key';

$token = JWTHash256::encode($header,$payload,$key);

```

### json web token

[](#json-web-token)

暂时只实现了sha256签名认证

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community6

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

Total

4

Last Release

2384d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cb27a2beed347a4d1aee5d564546601f011b0357d40c5180e7feabe038945c73?d=identicon)[bonza](/maintainers/bonza)

---

Top Contributors

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

### Embed Badge

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

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

PHPackages © 2026

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