Weave 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

Jwt Laravel Package

marvin255/jwt

marvin255/jwt is a lightweight JSON Web Token library for Laravel and PHP. It offers simple helpers to encode and decode JWT tokens, configure signing keys and algorithms, and add token-based authentication to your application with minimal setup and clean integration.

Deep Wiki
Context7

Simple JWT implementation for PHP.

Frequently asked questions about Jwt
How do I install marvin255/jwt in Laravel?
Install it with Composer using composer require marvin255/jwt. In Laravel, the package follows conventions with a service provider and configuration for the secret, signing algorithm, and TTL. After installation, set your JWT configuration values and start generating or validating tokens.
What is marvin255/jwt used for?
It is used to issue, sign, and validate JSON Web Tokens in Laravel and plain PHP applications. Typical use cases are stateless authentication, API access tokens, and secure data exchange between services. It keeps the core framework-agnostic while adding Laravel-friendly configuration, service provider integration, and middleware.
How do I generate a JWT token with marvin255/jwt?
Use the package's fluent token generation API to create and sign a JWT. You configure the signing algorithm, secret, and TTL first, then generate the token with the claims your application needs. The result is a signed token string you can return to a client or include in a request.
How do I validate a JWT token in Laravel with marvin255/jwt?
Use the package verification helpers to decode and validate the token signature and claims. In Laravel you can also rely on the provided middleware to validate tokens before a route runs. Expired or invalid tokens raise clear exceptions, which you can catch and convert into the appropriate HTTP response.
Does marvin255/jwt work outside Laravel?
Yes. The core library is framework-agnostic and can be used in any PHP project via Composer. Laravel-specific features such as the service provider and middleware are optional conveniences. You can use the same token generation and validation API in plain PHP.
How do I protect Laravel routes with marvin255/jwt middleware?
Add the package middleware to the routes or route groups you want to protect. The middleware validates the JWT before the request reaches your controller and raises clear exceptions for expired or invalid tokens. Configure the secret, algorithm, and TTL so validation matches how the tokens were issued.
How do I configure the JWT secret, algorithm, and TTL in marvin255/jwt?
The package follows Laravel conventions, so you configure the secret, signing algorithm, and token lifetime in the package configuration. Keep secrets out of source control and use environment-specific values. Signing and verification use the same configuration so token handling stays consistent.
What happens when a token is expired or invalid in marvin255/jwt?
marvin255/jwt raises clear exceptions for expired or invalid tokens instead of returning ambiguous results. You should catch those exceptions in your application and return an appropriate response, such as HTTP 401 for authentication failures. This makes it easier to distinguish expired tokens from other validation errors.
Can I use marvin255/jwt for stateless API authentication?
Yes. The package is built for issuing and validating JWTs, which enables stateless authentication without server-side sessions. In Laravel you can combine token generation with the provided middleware to protect API routes. Configure a suitable TTL and secret for your environment.
Is marvin255/jwt suitable for production use?
marvin255/jwt is a lightweight library with configurable signing, TTL, and clear validation exceptions, which are the core pieces needed for JWT-based authentication. For production, use strong secrets, HTTPS, appropriate token lifetimes, and proper exception handling. Because the core is framework-agnostic and dependency-light, it can fit Laravel and plain PHP deployments.
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.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core