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

Expiring Hash Laravel Package

apinstein/expiring-hash

Expiring Hash provides a simple PHP API for generating time-limited hashes and tokens, ideal for signed URLs, passwordless logins, and temporary cache keys. Values expire automatically, keeping your app secure without extra cleanup.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. apinstein/expiring-hash is a standalone PHP utility, not a Laravel package. Based on the description it provides HMAC-style signing of a payload plus an expiry, producing an opaque token intended to be embedded in a URL query string and later verified server-side. That is a capability we need, but it is delivered as a leaf library with no service provider, no facade, no config publishing, and no framework conventions. In a Laravel codebase it sits outside the container and must be instantiated manually or bound in a service provider by us. It also occupies a space Laravel has owned since 5.6: URL::temporarySignedRoute(), URL::signedRoute(), hasValidSignature(), and the ValidateSignature middleware cover the same requirement natively, using framework-managed keys (APP_KEY), hash_equals comparison, and expiry encoded in the URL. On architecture fit alone this is a weak buy.

Integration feasibility. Mechanically trivial — the library has no dependencies to speak of and no bootstrapping ceremony, so a thin wrapper (a SignedUrlService bound as a singleton with the secret injected from config) is a few hours of work. The real feasibility question is not "can we wire it up" but "does it still run." A repository at 13 stars with 0 dependents and no recent activity is very likely pinned to an old PHP constraint or to syntax/deprecations that break under PHP 8.2/8.3. Composer's platform check will tell us in minutes; that is the first gate.

Technical risk.

  • Abandonment. No maintainers, no dependents, no downstream battle-testing. Any defect we find, we own permanently. Zero ecosystem validation is the single largest risk.
  • Cryptographic correctness unverified. We must confirm: HMAC algorithm and whether the signature covers the entire payload (including all query parameters) or only the expiry — partial coverage means parameter tampering, which converts a signed-URL feature into a privilege-escalation vector. Also confirm constant-time comparison (hash_equals) versus ==.
  • Secret management. If the token carries no key identifier or version byte, key rotation invalidates every outstanding link atomically. We would need to add our own rotation/dual-accept logic, which erodes the "cheap dependency" premise.
  • Encoding fragility. Hex vs. base64 output determines whether tokens survive URL encoding, log pipelines, and email clients intact.
  • Commoditization. The core logic is roughly 40 lines of hash_hmac + pack/unpack + hash_equals. We can own it outright with tests for less effort than adopting and auditing someone else's.

Key questions.

  1. What PHP versions does composer.json permit, and does it install cleanly on our runtime without --ignore-platform-reqs?
  2. What exactly is inside the signed envelope — expiry only, or full parameter set? Is the expiry absolute or a relative TTL?
  3. Is comparison constant-time? Which HMAC algorithm, and is output truncated?
  4. License and last-commit date; are there open security-relevant issues?
  5. Do we have any requirement the framework's native signed URLs genuinely cannot meet (non-route payloads, cross-service token format, non-Laravel consumers)?

Integration Approach

Stack fit. Poor-to-neutral. Every capability described is native to modern Laravel, where signed URLs inherit APP_KEY handling, key rotation discipline via APP_PREVIOUS_KEYS, middleware enforcement, and the framework's security release cadence. Introducing a parallel secret and a parallel token format means two signing schemes in one codebase — a lasting cognitive and audit cost for no functional gain. The one defensible niche is a polyglot estate: if a non-PHP service must mint or verify the same token, a documented, language-agnostic HMAC envelope has value that Laravel's native format does not provide. That must be a stated requirement, not an assumption.

Recommended path (build, don't adopt). Do not add the dependency. Implement the token as an internal class — sign(array $payload, int $ttl): string / verify(string $token, int $maxAge): array — using hash_hmac('sha256', ...) and hash_equals, with a version byte and absolute expiry in the envelope. Add a key ID if rotation is in scope. Cover with unit tests: valid, expired, tampered payload, tampered expiry, wrong key, malformed token. This is one to two engineer-days and eliminates the abandonment risk entirely.

If we must adopt it (e.g., to match a token format already in production elsewhere): wrap it, never call it directly from controllers. Bind a single service in a provider, source the secret from config/secret manager (never env() outside config), and pin an exact version in composer.json. Add a characterization test suite immediately — it becomes our regression net because upstream has none.

Migration path. If signed links already exist in the wild, we cannot flip formats. Sequence: (1) implement the new signer and verifier; (2) deploy a verifier that accepts both formats behind a feature flag; (3) switch issuance to the new format only; (4) let the old format age out over one maximum TTL; (5) delete the legacy verifier and the dependency. TTL length sets the calendar — if any links carry 30-day expiry, that is a 30-day dual-accept window.

Compatibility. Treat PHP 8.x compatibility, deprecation warnings under E_ALL, and any reliance on removed extensions as unproven until a spike confirms otherwise. Budget the spike before committing to the adoption path.

Sequencing. Confirm requirements (is native Laravel signing sufficient?) → spike PHP 8 install and read the signing code → decide build vs. adopt → implement + test → dual-accept deploy → retire legacy.

Operational Impact

Maintenance. Adoption converts a solved framework concern into a permanent in-house liability: unmaintained code, no upstream security patches, and a bespoke secret to rotate. Building in-house is also a maintenance line item, but a small, tested, fully-understood one. Either way, this capability must appear in our dependency-review and key-rotation runbooks. The absence of a Laravel service provider means no php artisan surface for key rotation or link inspection — we build any operational tooling ourselves.

Support. No vendor, no maintainer, 13 stars, 0 dependents. There is no escalation path, no CVE feed to watch, and no community to consult. Incidents become internal debugging of unfamiliar crypto code under time pressure. For a security-adjacent component, that is the decisive factor.

Scaling. Effectively a non-issue. Verification is a stateless HMAC computation — O(1), no database or cache round-trip, trivially horizontally scalable, and cheap enough to run in middleware. The scaling caveat is revocation: signed URLs are bearer tokens with no server-side state, so we cannot invalidate one before its TTL. If the product needs single-use links or instant revocation, we need Redis-backed nonce tracking regardless of which library we pick — that is a product requirement, not a package feature, and should be surfaced before signing off.

Failure modes.

  • Clock skew across nodes, regions, or between services → links that expire early or outlive policy. Mitigate by encoding absolute expiry, keeping TTLs short, and enforcing NTP.
  • Key rotation without a key ID in the token → all outstanding links break simultaneously. Mitigate with dual-key acceptance.
  • Signature scope gaps → tampering with unsigned URL parameters.
  • Token leakage via Referer headers, access logs, and analytics — bearer URLs leak by design and grant full access for the TTL. Keep TTLs tight and avoid rendering signed URLs on pages that load third-party assets.
  • Encoding corruption → tokens mangled by URL or email transports produce intermittent 403s that are painful to reproduce.
  • PHP runtime upgrade → the library breaks during a platform upgrade and takes an unrelated release hostage.

Ramp-up. Low for any competent Laravel engineer: hours to understand, one to two days to wire, test, and deploy behind a dual-accept flag. The hidden cost is the security review — validating signature scope, comparison safety, and rotation behavior — which will likely exceed the integration effort itself.

Bottom line. Do not adopt. The capability is commoditized in the framework, the package is unmaintained with zero ecosystem validation, and the integration surface it saves is smaller than the wrapper we would have to write anyway. Recommend a one-day spike to confirm native Laravel signed URLs cover the requirement, a one-to-two-day internal implementation with tests if they do not, and reserve the dual-accept migration pattern only for the case where this token format already exists in production.

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.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings