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

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

hihone/jwt
==========

laravel-jwt

06PHP

Since Mar 1Pushed 7y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

jwt for lavavel
===============

[](#jwt-for-lavavel)

安装
--

[](#安装)

只要在你的 `composer.json` 文件require中加入下面内容，就能获得最新版.

```
composer require hihone/jwt:dev-master

```

然后需要运行 "composer update" 来更新你的项目

安装完后，生成 `config/jwt.php` 配置文件，

```
php artisan vendor:publish --provider="hihone\jwt\JWTServiceProvider"

```

使用
--

[](#使用)

```
//        JWT::payload([
//            'name' => 'hihone',
//            'sub' => '测试'
//        ]);
        dd(JWT::getToken());
#eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.W10.2Ue8Tp6Yh59Q8ioRlqz20USnswttxZ1KCeA99QFFLS4

JWT::payload([
    'name' => 'hihone',
    'sub' => '测试'
]);
dd(JWT::getToken());
#eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwOlwvXC9kZW1vLnRlc3QiLCJleHAiOjE1NTE0MzQ4NDgsInN1YiI6Iua1i-ivlSIsImF1ZCI6Imh0dHA6XC9cL2RlbW8udGVzdCIsIm5iZiI6MTU1MTQyNzY3OCwiaWF0IjoxNTUxNDI3NjQ4LCJqdGkiOiJKV1QxNTUxNDI3NjQ4NWM3OGU4NDBjZDk4MSIsIm5hbWUiOiJoaWhvbmUifQ.gDOpBG0PFFBAU2ObpSVZ0ZbAgN0QN2BiGonUUrV6BRw

```

验证 token
--------

[](#验证-token)

```
$token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwOlwvXC9kZW1vLnRlc3QiLCJleHAiOjE1NTE0MzQ4NDgsInN1YiI6Iua1i-ivlSIsImF1ZCI6Imh0dHA6XC9cL2RlbW8udGVzdCIsIm5iZiI6MTU1MTQyNzY3OCwiaWF0IjoxNTUxNDI3NjQ4LCJqdGkiOiJKV1QxNTUxNDI3NjQ4NWM3OGU4NDBjZDk4MSIsIm5hbWUiOiJoaWhvbmUifQ.gDOpBG0PFFBAU2ObpSVZ0ZbAgN0QN2BiGonUUrV6BRw';
$payload = JWT::verify($token);
捕获 JWTException 异常，

```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

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.

### Community

Maintainers

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

### Embed Badge

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

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

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[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)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

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

PHPackages © 2026

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