adhocore/jwt
Lightweight PHP JWT library with simple encode/decode APIs, support for common algorithms (HS/RS), claims validation, and key handling. Designed for quick integration in apps and APIs with minimal dependencies and clear error reporting.
firebase/php-jwt or league/oauth2-server) reduces attack surface and simplifies deployment.JWT class. No configuration files or complex DI containers needed.iss, exp, sub) and algorithms (HS256/RS256/ES256). Aligns with RFC 7519.beforeValidate/afterValidate) allow adaptation to niche use cases (e.g., custom token payloads).nbf/iat claims or token revocation logic). Requires custom logic for advanced use cases.league/oauth2-server or firebase/php-jwt, this may introduce redundancy.jwt-decode in JS instead).adhocore/jwt (focus on validation time)./api/health).auth:api) with a custom JWT validator.use Adhocore\Jwt\JWT;
$jwt = new JWT(['secret' => env('JWT_SECRET')]);
$decoded = $jwt->validateAndDecode($request->bearerToken());
Illuminate\Http\Request for bearer token extraction. Middleware example:
public function handle($request, Closure $next) {
$jwt = new JWT(['secret' => config('jwt.secret')]);
$jwt->validateAndDecode($request->bearerToken());
return $next($request);
}
RequestStack for token extraction.firebase/php-jwt) in the same project.league/oauth2-server).iss/aud claims)./auth/login).Authorization: Bearer header.Symfony\Component\Cache) if validation is a bottleneck.composer update adhocore/jwt).Mockery to test validation logic.snyk or phpstan) for crypto-related vulnerabilities.firebase/php-jwt (more features) or spomky-labs/token-refresher (for refresh tokens).How can I help you explore Laravel packages today?