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

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

zhitoo/jwt
==========

Laravel jwt package

v1.0.1(2y ago)240MITPHPPHP ^7.2|^7.4|^8.0

Since Feb 16Pushed 2y ago1 watchersCompare

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

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

Laravel JWT Auth Package
========================

[](#laravel-jwt-auth-package)

this package add a new driver for authorization api based on JWT

### how can use it?

[](#how-can-use-it)

```
composer require zhitoo/jwt

```

### after install this package:

[](#after-install-this-package)

```
    php artisan vendor:publish Zhitoo\Jwt\JWTServiceProvider
    php artisan jwt:secret

```

go to User model

```
use Zhitoo\Jwt\HasApiTokens;
.
.
.
use HasApiTokens

```

put auth:jwt to your route middleware like below

```
Route::middleware('auth:jwt')->get('/user', function (Request $request) {
    return $request->user();
});

```

login use createToken method fot create a new jwt token for current logedin user

```
Route::post('/login', function (Request $request) {
    $email = $request->input('email');
    $password = $request->input('password');
    if (\Illuminate\Support\Facades\Auth::attempt(['email' => $email, 'password' => $password])) {
        return response()->json(['ok' => true, 'token' => $request->user()->createToken()]);
    }
    abort(401);
});

```

logout use revokeAccessToken method

```
Route::middleware('auth:jwt')->post('/logout', function () {
    if (method_exists(auth()->user(), 'revokeAccessToken')) {
        auth()->user()->revokeAccessToken();
    }
    return response()->json(['ok' => true]);

});

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

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

Total

5

Last Release

736d ago

Major Versions

v0.5.0 → v1.0.02024-05-12

### Community

Maintainers

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

---

Top Contributors

[![zhitoo](https://avatars.githubusercontent.com/u/20835893?v=4)](https://github.com/zhitoo "zhitoo (34 commits)")

---

Tags

jwtlaravelLaravel Authjwt-auth

### Embed Badge

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

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

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)

PHPackages © 2026

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