Download the PHP package zenstruck/jwt without Composer
On this page you can find all versions of the php package zenstruck/jwt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download zenstruck/jwt
More information about zenstruck/jwt
Files in zenstruck/jwt
Download zenstruck/jwt
More information about zenstruck/jwt
Files in zenstruck/jwt
Vendor zenstruck
Package jwt
Short Description JSON Object Signing and Encryption library for PHP.
License MIT
Package jwt
Short Description JSON Object Signing and Encryption library for PHP.
License MIT
Please rate this library. Is it a good library?
Informations about the package jwt
zenstruck/jwt
Provides a lightweight implementation of the JWS (JSON Web Signature) specification. This library is a fork of namshi/jose.
Requirements
- PHP 5.4.8+ (tested on 5.4, 5.5, 5.6, 7 and HHVM)
- (Optional) OpenSSL extension (when using RSA/ECDSA signers)
- (Optional) symfony/polyfill-php56 library (when HMAC signers in PHP versions less than 5.6)
Installation
composer require zenstruck/jwt
When using an HMAC signer in PHP versions less than 5.6
composer require symfony/polyfill-php56
Basic Usage
-
Create, encode and send a token to the user:
- Fetch encoded token from user, decode, verify, validate and access custom claims
Token Builder
Signers
HMAC
These signers require an identical key string to be used for signing and validating.
Algorithm | Signer Class |
---|---|
HS256 | Zenstruck\JWT\Signer\HMAC\HS256 |
HS384 | Zenstruck\JWT\Signer\HMAC\HS384 |
HS512 | Zenstruck\JWT\Signer\HMAC\HS512 |
Usage
RSA/ECDSA (OpenSSL)
These signers require a private key for signing and a public key for verifying.
- PrivateKey: a
string
(key contents or filename),resource
or instance ofZenstruck\JWT\Signer\OpenSSL\PrivateKey
- PublicKey: a
string
(key contents or filename),resource
or instance ofZenstruck\JWT\Signer\OpenSSL\PublicKey
- Keychain: instance of
Zenstruck\JWT\Signer\OpenSSL\Keychain
contains both a public and private key. Can be passed as the key to bothSigner::sign()
andSigner::verify()
.
Algorithm | Signer Class |
---|---|
RS256 | Zenstruck\JWT\Signer\OpenSSL\RSA\RS256 |
RS384 | Zenstruck\JWT\Signer\OpenSSL\RSA\RS384 |
RS512 | Zenstruck\JWT\Signer\OpenSSL\RSA\RS512 |
ES256 | Zenstruck\JWT\Signer\OpenSSL\ECDSA\ES256 |
ES384 | Zenstruck\JWT\Signer\OpenSSL\ECDSA\ES384 |
ES512 | Zenstruck\JWT\Signer\OpenSSL\ECDSA\ES512 |
Usage
Keychain
A keychain contains both a public and private key. When passed a keychain as the key, the signer uses the proper key for the operation.
Validation
Validator | Description |
---|---|
Zenstruck\JWT\Validator\IssuerValidator |
Ensures iss claim exists and matches expected value |
Zenstruck\JWT\Validator\SubjectValidator |
Ensures sub claim exists and matches expected value |
Zenstruck\JWT\Validator\AudienceValidator |
Ensures aud claim exists and matches expected value |
Zenstruck\JWT\Validator\ExpiresAtValidator |
Ensures exp claim exists is not greater than expected time |
Zenstruck\JWT\Validator\NotBeforeValidator |
Ensures nbf claim exists is not less than expected time |
Zenstruck\JWT\Validator\IssuedAtValidator |
Ensures iat claim exists and matches expected value |
Zenstruck\JWT\Validator\IdAtValidator |
Ensures jti claim exists and matches expected value |
Zenstruck\JWT\Validator\ChainValidator |
Combines any of the above validators together |
Usage
ValidatorBuilder
All versions of jwt with dependencies
PHP Build Version
Package Version
Requires
php Version
>=5.4.8
The package zenstruck/jwt contains the following files
Loading the files please wait ....