PHPackages                             little-apps/littlejwt - 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. little-apps/littlejwt

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

little-apps/littlejwt
=====================

Secure Your Laravel Web App with Little JWT - The Key to Effortless Token Management!

v2.3.1(1y ago)323.3k—0%[2 PRs](https://github.com/little-apps/LittleJWT/pulls)MITPHPPHP ^8.1CI passing

Since Feb 13Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/little-apps/LittleJWT)[ Packagist](https://packagist.org/packages/little-apps/littlejwt)[ Docs](https://getlittlejwt.com)[ GitHub Sponsors](https://github.com/little-apps)[ RSS](/packages/little-apps-littlejwt/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (20)Used By (0)

[![Little JWT](https://camo.githubusercontent.com/71cbb1db2541ee495b0f3c133334fecda435363b9a89e7dd7086afa21d1d167a/68747470733a2f2f692e696d6775722e636f6d2f4e3344306f55592e706e673f31)](https://camo.githubusercontent.com/71cbb1db2541ee495b0f3c133334fecda435363b9a89e7dd7086afa21d1d167a/68747470733a2f2f692e696d6775722e636f6d2f4e3344306f55592e706e673f31)

[![Latest Version on Packagist](https://camo.githubusercontent.com/bc2a31fd85103aa466268ef52ac6b40b613755f759e5e96a8d12fe99ee508515/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6974746c652d617070732f6c6974746c656a7774)](https://packagist.org/packages/little-apps/littlejwt)[![GitHub Tests Action Status](https://camo.githubusercontent.com/ec64751b6f8ec8d0fe6eb7610b22da9700ab5728c2136bd82e1a7bbca3da4d36/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c6974746c652d617070732f6c6974746c656a77742f72756e2d74657374732e796d6c3f6272616e63683d6d61696e)](https://github.com/little-apps/littlejwt/actions?query=workflow%3Arun-tests+branch%3Amain)[![Format (PHP)](https://github.com/little-apps/LittleJWT/actions/workflows/laravel-pint.yml/badge.svg)](https://github.com/little-apps/LittleJWT/actions/workflows/laravel-pint.yml)[![Coverage Status](https://camo.githubusercontent.com/a701e3fed4a66d5c190487ce0147a4f15a5a144981f810922b73a40bb049dbb0/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6c6974746c652d617070732f4c6974746c654a57542f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/little-apps/LittleJWT?branch=main)[![Total Downloads](https://camo.githubusercontent.com/198a4bbf030d386bc4409779f4f69b0042a99c730644340ffda07d3642856061/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6974746c652d617070732f6c6974746c656a77742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/little-apps/littlejwt)

Secure Your Laravel Web App with Little JWT - The Key to Effortless Token Management!

Show Your Support
-----------------

[](#show-your-support)

Little Apps relies on people like you to keep our software running. If you would like to show your support for Little Registry Cleaner, then you can [make a donation](https://www.little-apps.com/?donate) using PayPal, Payza or credit card (via Stripe). Please note that any amount helps (even just $1).

Requirements
------------

[](#requirements)

- PHP v8.1 or higher
- Laravel 10.x, 11.x, or 12.x

Installation
------------

[](#installation)

Install the package via composer:

```
composer require little-apps/littlejwt
```

Publish the config file with:

```
php artisan vendor:publish --tag="littlejwt-config"
```

Generate a secret phrase for building and validating JWTs:

```
php artisan littlejwt:phrase
```

> Information on generating different types of keys can be found in [the documentation](https://docs.getlittlejwt.com/json-web-keys#key-types).

Upgrading
---------

[](#upgrading)

**IMPORTANT:** Before continuing, please note v2.0 is still in beta and is not recommended for production systems.

Create a backup of the config file:

```
cp config/littlejwt.php config/littlejwt.php.old
```

Upgrade the package via composer:

```
composer require little-apps/littlejwt:"^2.3.0"
```

Publish the new config file (overwriting the existing config file):

```
php artisan vendor:publish --tag="littlejwt-config" --existing
```

> You will need to manually set the config file to match the old config file.

Usage
-----

[](#usage)

### Building JWTs

[](#building-jwts)

```
use LittleApps\LittleJWT\Facades\LittleJWT;
use LittleApps\LittleJWT\Build\Builder;

$jwt = LittleJWT::create(function (Builder $builder) {
    $builder
        // Adds claim 'abc' with value 'def' to header claims.
        ->abc('def', true)
        // Adds claim 'ghi' with value 'klm' to payload claims.
        ->ghi('klm')
        // Adds claim 'nop' with value 'qrs' to payload claims.
        ->nop('qrs', false);
});

$token = (string) $jwt;
// $token = "ey...";
```

### Validating JWTs

[](#validating-jwts)

```
use LittleApps\LittleJWT\Facades\LittleJWT;
use LittleApps\LittleJWT\Validation\Validator;

$token = "ey...";

$passes = LittleJWT::validateToken($token, function (Validator $validator) {
    $validator
        // Checks the value of the 'abc' claim in the header === (strictly equals) 'def'
        ->equals('abc', 'def', true, true)
        // Checks the value of the 'ghi' claim in the payload == (equals) 'klm'
        ->equals('ghi', 'klm')
        // Checks the value of the 'nop' claim in the payload === (strictly equals) 'qrs'
        ->equals('nop', 'qrs', true, false);
});

if ($passes) {
    // JWT is valid.
} else {
    // JWT is invalid.
}
```

Further Documentation
---------------------

[](#further-documentation)

Further documentation is located at [docs.getlittlejwt.com](https://docs.getlittlejwt.com/).

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

### Libraries

[](#libraries)

Little JWT is built using the following libraries:

- [Laravel](https://laravel.com/)
- [Laravel Package Skeleton](https://github.com/spatie/package-skeleton-laravel)
- [PHP JWT Framework](https://github.com/web-token/jwt-framework)

### Contributors

[](#contributors)

Thank you to the following for their contributions:

- [Little Apps](https://github.com/little-apps)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance64

Regular maintenance activity

Popularity30

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 95.8% 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 ~73 days

Recently: every ~89 days

Total

17

Last Release

381d ago

Major Versions

v1.5.1 → v2.0.0-beta2023-05-20

PHP version history (5 changes)v1.0.0PHP ^8.0

v1.1.0PHP ^7.4|^8.0

v1.5.0PHP ^7.4|^8.0|^8.1

v2.1.0-betaPHP ^8.1||^8.2

v2.3.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/b4f173ad755fec3e207e03e7dc11fb69f8ec02a769d135ae1a1cf3e730b499d5?d=identicon)[little-apps](/maintainers/little-apps)

---

Top Contributors

[![little-apps](https://avatars.githubusercontent.com/u/1192535?v=4)](https://github.com/little-apps "little-apps (687 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (22 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (7 commits)")[![mend-bolt-for-github[bot]](https://avatars.githubusercontent.com/in/16809?v=4)](https://github.com/mend-bolt-for-github[bot] "mend-bolt-for-github[bot] (1 commits)")

---

Tags

jsonwebtokenjwtlaravelphplaravelJSON Web Tokenlittle-appslittlejwt

###  Code Quality

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/little-apps-littlejwt/health.svg)

```
[![Health](https://phpackages.com/badges/little-apps-littlejwt/health.svg)](https://phpackages.com/packages/little-apps-littlejwt)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k89.8M1.0k](/packages/spatie-laravel-permission)[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)[jeffgreco13/filament-breezy

A custom package for Filament with login flow, profile and teams support.

1.0k1.7M41](/packages/jeffgreco13-filament-breezy)[spatie/laravel-login-link

Quickly login to your local environment

4381.2M1](/packages/spatie-laravel-login-link)

PHPackages © 2026

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