PHPackages                             jimtools/jwt-auth - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. jimtools/jwt-auth

ActiveLibrary[HTTP &amp; Networking](/categories/http)

jimtools/jwt-auth
=================

PSR-15 JWT Authentication middleware, A replacement for tuupola/slim-jwt-auth

3.0.1(2mo ago)20142.3k—6.3%3[2 issues](https://github.com/JimTools/jwt-auth/issues)2MITPHPPHP ~8.2 || ~8.3 || ~8.4 || ~8.5CI passing

Since Feb 19Pushed 2mo ago5 watchersCompare

[ Source](https://github.com/JimTools/jwt-auth)[ Packagist](https://packagist.org/packages/jimtools/jwt-auth)[ Docs](https://github.com/jimtools/jwt-auth)[ GitHub Sponsors](https://github.com/JimTools)[ RSS](/packages/jimtools-jwt-auth/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (18)Versions (14)Used By (2)

PSR-15 JWT Authentication Middleware
====================================

[](#psr-15-jwt-authentication-middleware)

[![Latest Version](https://camo.githubusercontent.com/6edd4d1a53c9018c0437b9ad364becc731c47287605ea5abbba261d95c7aae32/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a696d746f6f6c732f6a77742d617574682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jimtools/jwt-auth)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://camo.githubusercontent.com/12a72ccaeb40c7f01f76c2b49ac7e26849b4254d0d301052f8f3a5b65bdce1ec/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a696d746f6f6c732f6a77742d617574682f74657374732e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265)](https://github.com/jimtools/jwt-auth/actions)[![Coverage](https://camo.githubusercontent.com/90e539b84c856ed1ed8a47dec61bce08c11af5ad79fd47f113f9ac2c3097a65b/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f67682f6a696d746f6f6c732f6a77742d617574682f6d61696e2e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/github/jimtools/jwt-auth/branch/main)

This package is a PSR-15 compliant JSON Web Token authentication middleware, which take a JWT from the headers or cookies.

```
use JimTools\JwtAuth\Decoder\FirebaseDecoder;
use JimTools\JwtAuth\Middleware\JwtAuthentication;
use JimTools\JwtAuth\Exceptions\AuthorizationException;
use JimTools\JwtAuth\Options;
use JimTools\JwtAuth\Secret;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;

require './vendor/autoload.php';

$app = AppFactory::create();
$app->addErrorMiddleware(false, false, false)
    ->setErrorHandler(AuthorizationException::class, new MyErrorHandler());

$middleware = new JwtAuthentication(
    new Options(),
    new FirebaseDecoder(new Secret('tooManySecrets', 'HS256'))
);

$app->get('/protected', static function (Request $request, Response $response, array $args) {
    $response->getBody()->write('you will need a token');
    return $response;
})->addMiddleware($middleware);

$app->run();
```

Note

V1 is still supported!! For documentation on v1.x which is compatible with `tuupola/slim-jwt-auth`see [1.x](https://github.com/JimTools/jwt-auth/blob/1.x/README.md) or [GitHub Pages](https://jimtools.github.io/jwt-auth/1.x/)

Install
-------

[](#install)

The recommended way to install packages is through [composer](https://getcomposer.org/).

```
composer require jimtools/jwt-auth
```

Documentation
-------------

[](#documentation)

GitHub issues are used for only to discuss bugs and new features, for support please use GitHub discussions.

- [Documentation](https://jimtools.github.io/jwt-auth/main)
- [Support](https://github.com/JimTools/jwt-auth/discussions)
- [Bugs](https://github.com/JimTools/jwt-auth/issues)

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

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

[](#contributing)

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

License
-------

[](#license)

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

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance85

Actively maintained with recent releases

Popularity43

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 60.3% 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

Recently: every ~27 days

Total

13

Last Release

62d ago

Major Versions

1.0.2 → 2.0.02024-09-27

1.1.0 → 2.2.02024-12-15

2.3.1 → 3.0.02025-12-20

1.x-dev → 3.0.12026-03-17

PHP version history (4 changes)1.0.0PHP ^7.4|^8.0

2.0.0PHP ~8.1|~8.2|~8.3

2.1.0PHP ~8.1|~8.2|~8.3|~8.4

2.3.0PHP ~8.2 || ~8.3 || ~8.4 || ~8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a8f399e98e07029916ac5862e3a578292a54d4108a489f5ee60bf8ddccba1d8?d=identicon)[JimTools](/maintainers/JimTools)

---

Top Contributors

[![tuupola](https://avatars.githubusercontent.com/u/21913?v=4)](https://github.com/tuupola "tuupola (255 commits)")[![JimTools](https://avatars.githubusercontent.com/u/1222052?v=4)](https://github.com/JimTools "JimTools (152 commits)")[![dakujem](https://avatars.githubusercontent.com/u/443067?v=4)](https://github.com/dakujem "dakujem (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![jhmoon2000](https://avatars.githubusercontent.com/u/30658871?v=4)](https://github.com/jhmoon2000 "jhmoon2000 (1 commits)")[![jv-k](https://avatars.githubusercontent.com/u/5808914?v=4)](https://github.com/jv-k "jv-k (1 commits)")[![Kiina](https://avatars.githubusercontent.com/u/2419591?v=4)](https://github.com/Kiina "Kiina (1 commits)")[![klarsson](https://avatars.githubusercontent.com/u/17089222?v=4)](https://github.com/klarsson "klarsson (1 commits)")[![mbolli](https://avatars.githubusercontent.com/u/722725?v=4)](https://github.com/mbolli "mbolli (1 commits)")[![N-M](https://avatars.githubusercontent.com/u/781417?v=4)](https://github.com/N-M "N-M (1 commits)")[![orx0r](https://avatars.githubusercontent.com/u/2333215?v=4)](https://github.com/orx0r "orx0r (1 commits)")[![TiMESPLiNTER](https://avatars.githubusercontent.com/u/598854?v=4)](https://github.com/TiMESPLiNTER "TiMESPLiNTER (1 commits)")[![tuefekci](https://avatars.githubusercontent.com/u/2657626?v=4)](https://github.com/tuefekci "tuefekci (1 commits)")[![BafS](https://avatars.githubusercontent.com/u/588205?v=4)](https://github.com/BafS "BafS (1 commits)")[![xu42](https://avatars.githubusercontent.com/u/12060792?v=4)](https://github.com/xu42 "xu42 (1 commits)")[![bezumkin](https://avatars.githubusercontent.com/u/1257284?v=4)](https://github.com/bezumkin "bezumkin (1 commits)")[![byan](https://avatars.githubusercontent.com/u/383327?v=4)](https://github.com/byan "byan (1 commits)")

---

Tags

jwt-authjwt-authenticationpsr-15psr-7jwtjsonmiddlewareauthpsr-15

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[tuupola/slim-basic-auth

PSR-7 and PSR-15 HTTP Basic Authentication Middleware

4442.0M26](/packages/tuupola-slim-basic-auth)[mezzio/mezzio

PSR-15 Middleware Microframework

3883.6M97](/packages/mezzio-mezzio)[relay/relay

A PSR-15 server request handler.

3302.1M86](/packages/relay-relay)[mezzio/mezzio-authentication

Authentication middleware for Mezzio and PSR-7 applications

121.6M26](/packages/mezzio-mezzio-authentication)[jasny/auth

Authentication, authorization and access control for Slim Framework and other PHP micro-frameworks

11816.4k1](/packages/jasny-auth)[middlewares/payload

Middleware to parse the body of the request with support for json, csv and url-encode

32466.8k17](/packages/middlewares-payload)

PHPackages © 2026

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