Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Simplejwt Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • API Security & Authentication:

    • Implement JWT-based authentication for RESTful APIs, replacing session-based auth or legacy token systems (e.g., API keys).
    • Enable stateless authentication for microservices, reducing server-side session storage costs.
    • Support OAuth 2.0/OpenID Connect flows (e.g., token validation for access_token/id_token).
  • Roadmap Priorities:

    • Phase 1: Replace custom JWT logic (e.g., manual base64 encoding/decoding) with a standardized, maintained library.
    • Phase 2: Add JWE (JSON Web Encryption) for secure data transmission (e.g., encrypting PII in tokens).
    • Phase 3: Integrate with key rotation systems (e.g., auto-refreshing kid claims for RSA/ECDSA keys).
  • Build vs. Buy:

    • Buy: Avoid reinventing JWT/JWE logic (e.g., cryptographic edge cases, RFC compliance).
    • Customize: Extend the library for domain-specific claims (e.g., scope, aud validation rules).
    • Avoid: Rolling your own crypto (security risk) or using under-maintained packages.
  • Use Cases:

    • Mobile/Web Apps: Secure client-server communication (e.g., SPAs, native apps).
    • Serverless: Authenticate AWS Lambda functions via JWTs.
    • IoT/Edge: Lightweight token validation for constrained devices (PHP-FPM + JWT).
    • Compliance: Meet GDPR/HIPAA requirements for encrypted data-in-transit (JWE).

When to Consider This Package

Adopt This Package If:

  • Your stack uses PHP 8.0+ and requires JWT/JWE support (e.g., Laravel, Symfony, custom APIs).
  • You need RFC-compliant JWT/JWE (e.g., HS256, RS256, ECDSA, EdDSA, AES-GCM).
  • You want key management (e.g., JWK sets, PEM files, symmetric/HMAC keys).
  • Your team lacks cryptography expertise but needs secure token handling.
  • You’re migrating from legacy auth (e.g., Basic Auth, custom tokens) to stateless JWT.
  • You require multi-algorithm support (e.g., hybrid RSA+AES for JWE).

Look Elsewhere If:

  • You need active maintenance (last release: 2026, but changelog shows recent fixes).
  • Your project uses PHP < 8.0 (requires gmp, openssl, sodium extensions).
  • You need enterprise-grade support (e.g., commercial libraries like Auth0 PHP SDK).
  • You’re building a blockchain/DLT system (consider specialized libraries like Elliptic for ECDSA).
  • You require JWT revocation (this library doesn’t support blacklists; pair with a Redis cache or database).

How to Pitch It (Stakeholders)

For Executives:

"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."

For Engineers:

*"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:

  1. composer require kelvinmo/simplejwt.
  2. Load keys into a KeySet (e.g., from PEM/JWK files).
  3. Sign tokens: $jwt->encode($keySet).
  4. 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-jwt and validate with our Laravel/Symfony stack."*

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation