kelvinmo/simplejwt
SimpleJWT is a lightweight PHP 8+ library for JWT/JWS/JWE and JWK/COSE keys. Supports HS/RSA/ECDSA/EdDSA signatures, key management (RSA-OAEP, AES-KW, PBES2, ECDH-ES/X25519) and AES-GCM/CBC-HS encryption.
Strengths:
AlgorithmInterface, KeyInterface) allows custom algorithms or key types if needed.Gaps:
HasApiTokens trait for Sanctum).VerifyJWTToken) can integrate with Laravel’s pipeline.Resource classes.personal_access_tokens table (Sanctum) or custom tables for revocation lists.revoked_tokens) with token hashes or IDs for blacklisting.alg/enc headers (e.g., HS256 vs. RS256) can cause silent failures. Laravel’s validation layer must enforce consistency.gmp, openssl, and sodium extensions. PHP environments (e.g., shared hosting) may lack these.exp/nbf claims require synchronized server/client clocks. Laravel’s Carbon can help manage this.Auth::user() vs. decoded claims)?Auth facade with JWT-based logic. Use HasApiTokens trait for Sanctum compatibility.VerifyJWTToken middleware to validate tokens on API routes.TokenGuard to support JWT in Laravel’s auth system.simplejwt as the underlying token engine, but retain Sanctum’s token storage or Passport’s OAuth2 flows.jwt-decode for client-side claim extraction, with server-side validation./api/auth/login).simplejwt for token generation/validation, store tokens in Sanctum’s personal_access_tokens table.revoked_tokens table).scope, aud) to align with OAuth2 or custom business logic./api/token/introspect).simplejwt (minimal changes needed).simplejwt for token generation but retain Passport’s authorization code flow.CreateNewUser to emit JWTs instead of sessions.kelvinmo/simplejwt via Composer.gmp, openssl, sodium)..env or AWS KMS).JWTService class to wrap simplejwt logic (e.g., token generation, validation).VerifyJWTToken) and guards (TokenGuard).revoked_tokens table with TTLs for short-lived tokens or manual revocation.openssl) for compatibility.simplejwt version in composer.json to avoid breaking changes.exp claims are correctly set and clocks are synchronized.alg headers match the key type (e.g., HS256 for symmetric keys).SimpleJWT\JWT::deserialise() to inspect tokens without validation./debug/token endpoint for introspection (e.g., claims, signaturesHow can I help you explore Laravel packages today?