NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist, #114 most downloaded on Packagist
A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.
Latest stable
v7.2.2
Last release 5 days ago
17 Nov 2026
Release timing varies
gaps range from 2 weeks to 8 months
Most releases are documented
notes for 39 of 45 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
45 releases · first in 2014
Drag across the ruler to compare, or tap a release to open it.
Jwt: document supported RFC specifications in README
Nothing published for this version
Moved firebase/php-jwt to https://github.com/googleapis/google-cloud-php
firebase/php-jwt to https://github.com/googleapis/google-cloud-phpYour coding agent can read these notes before it upgrades. Set up the MCP server →
Limit the number of segments a JWT can be exploded into
Skip parsing valid unsupported curves
RSA from JWK sometimes returns empty Instance
add environment for Release Please job
add key length validation for ec keys
Bug Fixes remove resource support
add key size validation (#613) (6b80341) NOTE: This fix will cause keys with a size below the minimally allowed size to break.
ExpiredException (#604) (f174826)update error text for consistency
## 6.10.0 (2023-11-28) ### Features * allow typ header override
## 6.9.0 (2023-10-04) ### Features * add payload to jwt exception
## 6.8.0 (2023-06-14) ### Features * add support for P-384 curve (#515) (5de4323) ### Bug Fixes * handle invalid http responses
add ed25519 support to JWK (public keys)
## 6.5.0 (2023-05-12) ### Bug Fixes * allow KID of '0' (#505) (9dc46a9) ### Miscellaneous Chores * drop support for PHP 7.3
check kid before using as array index
Added ES256 support to JWK parsing
Added Cached Key Sets (#397)!! See the README for usage instructions
Added Cached Key Sets (#397)!! See the README for usage instructions
Added $defaultAlg parameter to JWT::parseKey and JWT::parseKeySet (#426). This will allow users to parse JWKS which do not populate the alg parameter without having to manually edit the JSON.
revert the flag to json_decode to force object
Note: This fixes the PHP Fatal error the previous version tried to fix, but does so in a safer way.
Add flag to json_decode to force object
Add flag to json_decode to force object (#416)
Note: This technically breaks backwards compatibility, but it fixes a PHP Fatal error in the current release on JWT::decode which also broke backwards compatibility, so we hope it's justified 🤞
Note: There should be no issues with backwards compatibility unless types were being used incorrectly
Note: There should be no issues with backwards compatibility unless types were being used incorrectly
As a security fix, to avoid key type confusion (see #351), use of Firebase\JWT\Key is now required when decoding:
Note: This version is compatible with PHP >= 5.3
JWT::decode now must be Firebase\JWT\Key or array<string, Firebase\JWT\Key> (see #376)Firebase\JWT\JWK::parseKey is now Firebase\JWT\Key (see #392)Firebase\JWT\JWK::parseKeySet is now array<string, Firebase\JWT\Key> (see #376)Firebase\JWT\JWK::parseKeySet (see #376)JSON_UNESCAPED_SLASHES is now used for JSON decoding (see #376)ASN1_INTEGER, ASN1_SEQUENCE, and ASN1_BIT_STRING have been removed (see #376)JWT::encode requires third argument $alg (see #377)JWT::sign requires third argument $alg (see #377)Firebase\JWT\KeyKey object in JWT::decodeAs a security fix, to avoid key type confusion (see #351), use of Firebase\JWT\Key is now required when decoding:
use Firebase\JWT\JWT;
// previous (v5.5.1 and below)
$decoded = JWT::decode($jwt, $publicKey, 'RS256');
// new (v6.0.0)
use Firebase\JWT\Key;
$decoded = JWT::decode($jwt, new Key($publicKey, 'RS256'));
And when you have more than one key, the second argument can be an array of Key objects:
use Firebase\JWT\JWT;
// previous (v5.5.1 and below)
$decoded = JWT::decode($jwt, [$publicKey1, $publicKey2], 'RS256');
// new (v6.0.0)
use Firebase\JWT\Key;
$decoded = JWT::decode($jwt, [
'kid1' => new Key($publicKey1, 'RS256'),
'kid2' => new Key($publicKey2, 'RS256')
]);
Note: When providing multiple keys, you must provide the matching $kid as the fourth parameter
to the JWT::encode function
Key object in JWK::parseKey and JWK::parseKeySetCalls to JWK::parseKey and JWK::parseKeySet now return a Key object and an array
of Key objects respectively.
use Firebase\JWT\JWK;
// previous (v5.5.1 and below)
$key = JWK::parseKey($jwk); // $key is a resource
$keys = JWK::parseKeySet($jwks); // $keys is an associative array key ID to resources
// new (v6.0.0)
$key = JWK::parseKey($jwk); // $key is a Key object
$keys = JWK::parseKeySet($jwks); // $keys is an associative array of key ID to Key objects
If the keys in your JWKS do not contain the "alg", you need to set it manually to the expected algorithm, for it to be able to parse successfully:
// new (v6.0.0) for JWKS which do not contain "alg"
foreach ($jwks as $k => $jwks) {
$jwks[$k]['alg'] = 'RS256'; // the expected alg of your JWKS
}
$keys = JWK::parseKeySet($jwks); // $keys is an associative array of key ID to Key objects
This release fixes BC issues caused by the changes in 5.5.0:
This release fixes BC issues caused by the changes in 5.5.0:
resource or OpenSSLAsymmetricKey (#371)The recommended usage of this library has changed. A Key object should now be used as the second argument to JWT::decode instead of using the allowed_
!!IMPORTANT!!
The recommended usage of this library has changed.
A Key object should now be used as the second argument to JWT::decode instead of using the
allowed_algs array. This will prevent key/algorithm type confusion:
// Previous way to call "decode"
Firebase\JWT\JWT::decode($jwt, $publicKey, ['RS256']);
// New (safer) way to call "decode"
$key = new Firebase\JWT\Key($publicKey, 'RS256');
Firebase\JWT\JWT::decode($jwt, $key);
Please see #351 for more information on the issue, and #365 for the merged changes.
The README has also been updated to reflect the new usage.
### Features * add Ed25519 support to JWT (#343) * make JWK::parseKey public (#337) ### Bug Fixes * export-ignore github dir
allow for null d values in RSA JWK
fix: add missing use statement in JWK
Backslashes for native function invocations
Remove unnecessary check for json_last_error
json_last_error (#263)Support RS384 and RS512. See #117. Thanks @joostfaassen!
JWT::verify to handle OpenSSL errors.
See #159. Thanks @bshaffer!array type hinting to decode method
See #101. Thanks @hywak!Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Fixed, stable release for packagist
Fixed, stable release for packagist
One column per quarter.