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 Signature Algorithm Hmac Laravel Package

web-token/jwt-signature-algorithm-hmac

HMAC signature algorithm support for the web-token/jwt framework. Provides HS256, HS384, and HS512 signing and verification using shared secrets, integrating with JWT creation and validation in PHP.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. web-token/jwt-signature-algorithm-hmac is not a JWT library — it is a leaf algorithm provider in the modular web-token/jwt-framework ecosystem (Spomky-Labs). Its classes (HS256, HS384, HS512) implement WebToken\Signature\Algorithm\SignatureAlgorithm and must be wired into a JWSBuilder/JWSVerifier or JWTBuilder supplied by web-token/jwt-library (or the older jwt-core/jwt-signature split). There is no service provider, facade, config file, or Laravel container binding. It is a dependency of a dependency — installing it alone yields nothing callable from a Laravel app.

Integration feasibility. Composer-installable in seconds; usable only when paired with the correct matching parent package version. Version alignment across jwt-library, jwt-signature, jwt-encoding, and this package is the actual integration cost, and it is not trivial for teams unfamiliar with the framework's split-package model. For a Laravel project that just needs HMAC JWTs, firebase/php-jwt or tymon/jwt-auth (which already bundles HMAC) delivers the same result with a fraction of the surface area. Feasibility is high only if the team is already committed to the web-token stack.

Technical risk. Low code-level risk: MIT licensed, HS256/384/512 are RFC 7518 stable, and the package rarely changes because HMAC is frozen cryptography. The material risks are: (1) dependency-graph drift if the parent framework's major version advances without a coordinated bump; (2) algorithm-confusion exposure if the verifier is configured loosely (accepting none or unexpected algs) — this is a consumer-side mistake the package does not guard against; (3) shared-secret management, which is entirely outside this package's scope and is where real incidents happen.

Key questions. Which parent jwt-library version and PHP constraint are we targeting (v3.x requires PHP 8.1+)? Do we actually need symmetric JWTs, or does our threat model call for RS256/EdDSA with asymmetric keys? Are we introducing a second JWT stack alongside an existing Passport/Sanctum/firebase/php-jwt implementation? Who owns secret rotation, and can tokens be revoked? Why are we adopting a 14-star, 0-dependent sub-package instead of the meta-package that bundles it?

Integration Approach

Stack fit. Pure PHP 8.x Composer package; no Laravel coupling, so it fits any Laravel 9/10/11 project in principle. In practice it competes directly with three incumbent options: laravel/sanctum (opaque tokens), laravel/passport (OAuth2 with asymmetric keys), and tymon/jwt-auth or firebase/php-jwt (simple HS256). This package is the correct choice only if the team has standardized on web-token for signing/verification primitives and wants an explicit, auditable algorithm import.

Migration path. Two scenarios. Greenfield on web-token: trivial — declare matching versions of web-token/jwt-library and this package, register the HS algorithms in a AlgorithmManager, done. Migrating from firebase/php-jwt or tymon/jwt-auth: not worth it for HMAC alone. The encode/decode call sites, claims handling, and middleware all change; the only gain is a different internal abstraction. Recommend migrating the whole JWT layer at once, or not at all — do not mix two stacks.

Compatibility. Pin web-token/jwt-library and this package to identical major versions; mismatch is the most common failure (Algorithm not supported at runtime). Verify the parent's PHP constraint against the target Laravel version's supported PHP range (Laravel 10 → PHP 8.1–8.3; Laravel 11 → PHP 8.2–8.4). Confirm the package version resolves cleanly against any already-installed web-token sub-packages (jwt-encoding, jwt-key-management). Test in HTTP middleware, queue workers, and CLI commands — token verification typically runs on every request and in every job.

Sequencing. (1) Decide whether a new JWT primitive is needed at all; if not, stop here. (2) If yes, adopt the meta-package web-token/jwt-library as the single entry point rather than cherry-picking sub-packages — the modular split is an implementation detail, not a recommendation to micro-depend. (3) Wrap encode/verify in a single JwtService with an explicit AlgorithmManager allow-list (HS256 only unless there is a reason). (4) Source secrets from Laravel's config/env/Secrets Manager, never from code. (5) Add integration tests covering alg-confusion, expired tokens, and tampered signatures before shipping.

Operational Impact

Maintenance. This particular sub-package is near-static because HMAC is stable, so direct maintenance is minimal. The maintenance burden lives upstream: the web-token framework is actively developed and periodically reorganizes its package boundaries (the v1 → v2 split is the cautionary example), which means parent-version upgrades will occasionally require touching this dependency even though its code has not changed. Budget for that.

Support. No Laravel-facing documentation, no service provider, no facades, no Stack Overflow footprint at this specific level. Support flows through the parent framework's docs and repository. A Laravel team member debugging an issue will typically end up reading web-token's JWS/JWT builder docs, not this package's README. Acceptable for a team already in that ecosystem; a real tax for one that is not.

Scaling. HMAC verification is cheap (single hash), stateless, and horizontally scalable — no DB hit per request, safe behind load balancers and in serverless/FPM workers. The scaling pressure is not compute but secret distribution: every service that verifies tokens must hold the same shared secret, so a shared secret becomes a blast-radius concern as the surface grows. If the system spans many services or third-party verifiers, prefer asymmetric algorithms (RS256/ES256/EdDSA) over HS256 for exactly this reason.

Failure modes. Most likely incidents, ranked: (1) version skew between this package and jwt-library breaking token verification at deploy; (2) alg-confusion or none-acceptance at the verifier due to loose configuration around this package rather than inside it; (3) secret leakage via committed env files; (4) key rotation causing a window of rejected tokens because rotation is not coordinated with issuance TTLs; (5) inability to revoke stateless tokens without a denylist. None of these are the package's fault; all are the integrator's responsibility, which is precisely the operational surface a TPM should own.

Ramp-up. A senior PHP engineer familiar with JWT concepts can ship an HS256 flow in roughly half a day, most of it spent reading web-token's builder API rather than this package. A team new to both JWT and the web-token modular ecosystem should plan 2–3 days including tests and secret management. Recommendation from a TPM standpoint: the 14 stars and 0 dependents accurately reflect that this is a sub-package, not a product — for a Laravel team, the defensible move is to adopt web-token/jwt-library wholesale if the framework is chosen, or firebase/php-jwt/tymon/jwt-auth if it is not. Do not land this package in isolation.

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.
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator