kelvinmo/simplejwt
SimpleJWT is a lightweight PHP library for creating, signing, verifying, and encrypting JSON Web Tokens (JWT/JWS/JWE). Supports JWK/COSE keys, HMAC/RSA/ECDSA/EdDSA algorithms, and common key management and AES encryption methods.
API Security & Authentication:
access_token/id_token).Roadmap Priorities:
base64 encoding/decoding) with a standardized, maintained library.kid claims for RSA/ECDSA keys).Build vs. Buy:
scope, aud validation rules).Use Cases:
gmp, openssl, sodium extensions)."SimpleJWT is a drop-in PHP library that lets us securely authenticate users and services via JSON Web Tokens (JWT), reducing fraud risk and cutting server costs. It supports industry-standard algorithms (RSA, ECDSA, AES) and encrypted tokens (JWE) for compliance with GDPR/HIPAA. By adopting this, we avoid reinventing crypto (a security liability) and future-proof our APIs for microservices, mobile apps, and IoT. The open-source BSD license keeps costs low, while the RFC-compliant design ensures interoperability with tools like Auth0 and Okta. ROI: Faster development, lower auth-related bugs, and scalable security."
*"SimpleJWT is a batteries-included JWT/JWE library for PHP 8+ that handles:
- Signing/verification (HS256, RS256, ES256, EdDSA).
- Key management (JWK sets, PEM, symmetric keys).
- Encryption (AES-GCM, RSA-OAEP, ECDH).
- Multi-recipient tokens (e.g., for distributed systems).
Why this over alternatives?
- No dependencies beyond PHP extensions (
gmp,openssl,sodium).- Active maintenance (fixed PHP 8.4 deprecations, EdDSA/X25519 support).
- Lightweight (~1MB, no bloat).
Integration:
composer require kelvinmo/simplejwt.- Load keys into a
KeySet(e.g., from PEM/JWK files).- Sign tokens:
$jwt->encode($keySet).- Verify tokens:
SimpleJWT\JWT::decode($token, $keySet, 'HS256').Trade-offs:
- No built-in revocation (add a Redis cache for blacklists).
- Requires extension setup (but worth it for security).
Next steps: Benchmark against
firebase/php-jwtand validate with our Laravel/Symfony stack."*
How can I help you explore Laravel packages today?