Stage 02 · Test · Researched comparison
Best PHP JWT Libraries in 2026
firebase/php-jwt is the first pick for most teams. It is small, widely used, and handles signing and verifying tokens with minimal setup, which suits API authentication and service-to-service tokens. Choose lcobucci/jwt when you want a stricter, more configurable API with fine control over validation. Choose web-token/jwt-framework when you need JWK sets, multiple algorithms, or full JWS and JWE support. All three are open source.
By Shihab Mia
Published 27 Nov 2026 · 5 tools compared
We run no ads and no affiliate links at launch. The order of a list follows our published method. See how we score.
Prices are the starting prices vendors list publicly. Plans change, so confirm the current price on the vendor page before you buy.
Key takeaways
- firebase/php-jwt, lcobucci/jwt, web-token/jwt-framework and adhocore/jwt are free open-source packages installable with Composer.
- tymon/jwt-auth is not well maintained; Laravel projects should use the php-open-source-saver/jwt-auth fork instead.
- These libraries run in your own PHP process, so signing keys and tokens never leave your server.
- Feature depth varies: firebase/php-jwt is minimal, while web-token/jwt-framework covers JWK, JWS and JWE.
Who each pick is for
- Simple sign and verify in most PHP appsfirebase/php-jwt
- Teams wanting strict, configurable validationlcobucci/jwt
- Full JWS and JWE with JWK supportweb-token/jwt-framework
- Laravel apps needing JWT authphp-open-source-saver/jwt-auth
- Lightweight JWT with minimal dependenciesadhocore/jwt
Comparison
| Tool | Best for | Standout feature | Listed starting price | Free plan or trial |
|---|---|---|---|---|
| 1firebase/php-jwt | Simple sign and verify in most PHP apps | Small API and low setup cost | Free (open source) | Free plan |
| 2lcobucci/jwt | Teams wanting strict, configurable validation | Explicit builder API with strong validation controls | Free (open source) | Free plan |
| 3web-token/jwt-framework | Full JWS and JWE with JWK support | Broad feature set including JWK sets, JWS and JWE | Free (open source) | Free plan |
| 4php-open-source-saver/jwt-auth | Laravel apps needing JWT auth | Maintained fork of tymon/jwt-auth for Laravel | Free (open source) | Free plan |
| 5adhocore/jwt | Lightweight JWT with minimal dependencies | Very small footprint | Free (open source) | Free plan |
How we picked
We picked libraries that are real, standalone Composer packages and are currently maintained, based on their repositories and documentation. Criteria were fit for JWT signing and verification in PHP, framework support, licence and cost, and the main limits of each package. All entries are open source. We did not run benchmarks or collect user reviews. Prices and licences can change, so confirm details on each project page before you commit.
The tools, one by one
firebase/php-jwt
Best for simple sign and verify in most PHP apps

What it is and where it fits
This is the most common starting point for PHP JWT work. It encodes and decodes tokens, supports the HMAC and RSA families plus ECDSA, and lets you pass a key or a key set for verification. The API is a few static methods, so it fits small services and quick integrations.
It installs with Composer and runs on any PHP version the package supports, with no framework dependency. The licence is BSD-3-Clause. The main limit is scope: it does not manage JWK sets, key rotation, or encrypted tokens (JWE). Teams that need those features should look at web-token/jwt-framework. For plain signed tokens, it is enough.
Standout: Small API and low setup cost
Free (open source), as listed by the vendor (firebase/php-jwt website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Small API and low setup cost
- widely used with clear documentation
Drawbacks
- Limited to core JWT handling
- no built-in JWK set management
Skip it if this limit matters to you: limited to core JWT handling.
Verdict. A sensible pick for simple sign and verify in most PHP apps.
Alternatives in this guide: lcobucci/jwt, web-token/jwt-framework, php-open-source-saver/jwt-auth
lcobucci/jwt
Best for teams wanting strict, configurable validation

What it is and where it fits
lcobucci/jwt takes a builder approach. You construct tokens and validation rules step by step, which makes constraints like required claims, allowed algorithms, and time leeway explicit in code. That suits teams that want validation behavior spelled out rather than implied.
It is framework-agnostic, installs with Composer, and is released under the MIT licence. It supports the common signing algorithms and gives you control over key objects and signer configuration. The trade-off is more code to write for simple cases. If you only need to sign and verify a token in two lines, firebase/php-jwt is lighter.
Standout: Explicit builder API with strong validation controls
Free (open source), as listed by the vendor (lcobucci/jwt website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Explicit builder API with strong validation controls
- good documentation and active maintenance
Drawbacks
- More verbose setup than minimal libraries
- steeper learning curve for beginners
Skip it if this limit matters to you: more verbose setup than minimal libraries.
Verdict. A sensible pick for teams wanting strict, configurable validation.
Alternatives in this guide: firebase/php-jwt, web-token/jwt-framework, php-open-source-saver/jwt-auth
web-token/jwt-framework
Best for full JWS and JWE with JWK support

What it is and where it fits
This is the most complete option in the list. It covers JWS signing, JWE encryption, JWK and JWK set handling, and a wide range of algorithms. It is split into components, so you can install only the parts you need, and it integrates with Symfony through a bundle.
It installs with Composer and is MIT licensed. The extra capability comes with more concepts to learn: key management, algorithm selection, and serializer choices. It is a good fit for applications that issue encrypted tokens, rotate keys, or publish a JWKS endpoint. For a single HMAC-signed token, it is more than most projects need.
Standout: Broad feature set including JWK sets, JWS and JWE
Free (open source), as listed by the vendor (web-token/jwt-framework website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Broad feature set including JWK sets, JWS and JWE
- modular components
Drawbacks
- Larger surface area to learn
- more configuration than minimal libraries
Skip it if this limit matters to you: larger surface area to learn.
Verdict. A sensible pick for full JWS and JWE with JWK support.
Alternatives in this guide: firebase/php-jwt, lcobucci/jwt, php-open-source-saver/jwt-auth
php-open-source-saver/jwt-auth
Best for laravel apps needing JWT auth

What it is and where it fits
This package is the maintained fork of tymon/jwt-auth. It provides JWT authentication for Laravel: token issuing, guard integration, middleware, and config for secret and TTL. If you are on Laravel and want auth wired into the framework, this is the practical choice.
It installs with Composer and is MIT licensed. Because it is tied to Laravel, it does not help plain PHP projects or other frameworks. The original tymon/jwt-auth is not well maintained, so new Laravel projects should start with this fork. Check the package README for the Laravel versions it supports before upgrading.
Standout: Maintained fork of tymon/jwt-auth for Laravel
Free (open source), as listed by the vendor (php-open-source-saver/jwt-auth website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Maintained fork of tymon/jwt-auth for Laravel
- integrates with Laravel auth guards
Drawbacks
- Laravel-specific
- not usable outside a Laravel app
Skip it if this limit matters to you: laravel-specific.
Verdict. A sensible pick for laravel apps needing JWT auth.
Alternatives in this guide: firebase/php-jwt, lcobucci/jwt, web-token/jwt-framework
adhocore/jwt
Best for lightweight JWT with minimal dependencies

What it is and where it fits
adhocore/jwt is a compact library focused on signing and verifying tokens with little overhead. It suits scripts, small services, and projects that want a dependency with a narrow scope. The API is short and the package has few requirements.
It installs with Composer and is MIT licensed. The trade-off is breadth: it does not aim to cover JWK sets, JWE, or advanced key management, and its community is smaller than firebase/php-jwt or lcobucci/jwt. Verify the supported algorithms and PHP versions in the repository before adopting it, and prefer a larger library if you need extensive validation controls.
Standout: Very small footprint
Free (open source), as listed by the vendor (adhocore/jwt website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Very small footprint
- simple API for sign and verify
Drawbacks
- Smaller feature set and community than the top picks
- fewer algorithm options documented
Skip it if this limit matters to you: smaller feature set and community than the top picks.
Verdict. A sensible pick for lightweight JWT with minimal dependencies.
Alternatives in this guide: firebase/php-jwt, lcobucci/jwt, web-token/jwt-framework
Who should use what
If you need to sign and verify tokens in a plain PHP service with minimal code, start with firebase/php-jwt. If your team wants validation rules written out explicitly and fine control over claims and algorithms, use lcobucci/jwt. If you issue encrypted tokens, manage JWK sets, or publish a JWKS endpoint, choose web-token/jwt-framework. If you are building a Laravel app and want JWT auth tied to guards and middleware, use php-open-source-saver/jwt-auth rather than the unmaintained tymon/jwt-auth. For a tiny dependency in a script, adhocore/jwt is an option.
Questions to settle before you buy
What to check before you buy
- Confirm the package supports your PHP version and is actively maintained in its repository.
- Check which signing algorithms you need and that the library supports them.
- Decide whether you need JWK sets, key rotation, or JWE before picking a minimal library.
- For Laravel, verify the fork supports your Laravel version and replace tymon/jwt-auth.
- Review how the library validates claims such as exp, nbf, iss and aud, and set leeway deliberately.
FAQ
Is firebase/php-jwt still maintained?
Yes. The repository shows ongoing maintenance and releases. It remains the common default for simple JWT signing and verification in PHP. Check the repository for the latest release and supported PHP versions before adopting it.
Should I use tymon/jwt-auth in a new Laravel project?
No. tymon/jwt-auth is not well maintained. Use the php-open-source-saver/jwt-auth fork, which continues the package for Laravel and integrates with auth guards and middleware. Confirm the supported Laravel versions in its README.
Which library supports encrypted JWTs?
web-token/jwt-framework supports JWE in addition to JWS, along with JWK and JWK set handling. The other libraries in this list focus on signed tokens. If you need encryption or key set management, that package is the fit.
Do these libraries send my keys anywhere?
No. They run inside your PHP process, so signing keys and tokens stay on your server. Keep keys out of source control and load them from environment variables or a secrets store. This differs from third-party web tools, where you should never paste secrets.
Are these libraries free?
Yes. All five entries are open-source packages installable with Composer at no cost. Licences differ: firebase/php-jwt uses BSD-3-Clause, while the others listed use MIT. Review each licence if you redistribute code.
Sources we checked
Method: how we score · editorial policy.
Change log. First published 27 Nov 2026.