JWT Auth for Laravel

JSON Web Token authentication for Laravel and Lumen APIs, with token issuing, refresh and blacklisting.

Library
Composer
v2.3.0
11,494stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
58/100Fair
Development Activity8
Maintenance32
Community92
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
80/100Excellent
Architecture80
Code Quality80
Innovation82
Learning Curve80

JWT Auth (tymon/jwt-auth) brings stateless JSON Web Token authentication to Laravel and Lumen. It integrates with the framework’s auth guard system so you can authenticate API requests with a signed bearer token instead of session cookies, issuing tokens on login and validating them on every protected request.

The package handles the full token lifecycle: signing and verifying claims, refreshing expiring tokens, and blacklisting invalidated ones so logout actually revokes access. It ships an auth:api style guard, middleware for protecting routes, and Artisan helpers for generating the signing secret.

What You Get

  • A JWT auth guard that authenticates Laravel and Lumen requests from a bearer token.
  • Full token lifecycle: issue, verify, refresh and blacklist for real logout.
  • Route middleware for protecting API endpoints and reading the current user.
  • Configurable claims, TTL, signing algorithms and an Artisan secret generator.

Common Use Cases

  • Securing a stateless REST API consumed by SPAs or mobile apps.
  • Issuing short-lived access tokens with refresh for browser and native clients.
  • Invalidating tokens on logout or password change via the blacklist.

Under The Hood

Architecture

The library layers a JWT provider (signing/verification) beneath a token manager that issues, refreshes and blacklists tokens, exposed to Laravel through a custom Guard and middleware; a JWT facade and factory build tokens from user credentials and custom claims, and service providers wire everything into the framework’s auth and config systems.

Tech Stack

PHP for Laravel and Lumen, installed via Composer; depends on an underlying JWT signing library and the framework’s auth, cache (for blacklisting) and config components, with PHPUnit tests and StyleCI/Codecov integration.

Code Quality

A long-established, widely-adopted package with a substantial tests/ suite; recent maintenance activity is lower than its peak but the code is stable and battle-tested across the 2.x line, with clear separation between provider, manager, guard and middleware layers.

API Design

Integration is idiomatic Laravel: publish config, set the guard driver, protect routes with middleware and resolve the user via the auth system. The JWTAuth/auth() helpers keep issuing and refreshing tokens ergonomic, though claim customization requires reading the docs.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search