web-token/jwt-library
Read-only sub-repository of the JWT Framework: a PHP JSON Web Token library. For docs and contributions, see the main jwt-framework repo and the official documentation at https://web-token.spomky-labs.com/. MIT licensed.
This package is a low-level JWT building block—not meant for direct use. Install the full web-token/jwt-framework meta-package (composer require web-token/jwt-framework) instead. Start by configuring signing/encryption keys (via KeyManager), then integrate core services like JWTBuilder and JWTValidator into Laravel’s service container. The official docs provide foundational examples—adapt Symfony-style service definitions for Laravel using app()->singleton().
AuthService::issueToken(), AuthService::validateToken()) that delegate to JWTBuilder/JWTValidator—avoid sprinkling low-level JWT calls across controllers.JWTValidator into custom guards or middleware to validate access tokens; reuse Laravel’s Request/Response objects for seamless integration (e.g., JWTValidator::validate($request->bearerToken(), $checks)).JWKSet::createFromJson(), cache results (e.g., via Laravel Cache), and inject into JWTValidator.Check\Check to enforce app-specific rules (e.g., require organization_id claim), and register them as services for reusability across token types.web-token/jwt-signature, web-token/jwt-encryption)—this package alone throws Class not found errors. Check composer.lock to confirm all components are present.JWTValidationException lacks context—always call $e->getErrors() and log the exact failed checks + original payload (redact secrets!) to debug invalid tokens.new Validator(null, true)) to enforce header/payload immutability—otherwise, tokens can be tampered with post-validation.JWKSet objects serializes them safely—but avoid caching raw JSON responses; parse then cache the JWKSet instance to prevent runtime deserialization errors.tymon/jwt-auth, this library doesn’t provide auth('jwt') middleware or Token model hooks—expect to write boilerplate for auth guards, middleware, and exception handlers.How can I help you explore Laravel packages today?