HttpFoundation component, making it a natural fit for Symfony-based applications (e.g., Laravel with Symfony bridges like symfony/http-foundation). For vanilla Laravel, integration would require additional abstraction (e.g., wrapping Symfony’s Request object or adapting to Laravel’s Illuminate\Http\Request).Storage::temporaryUrl() but with custom expiration).UriSigner, offering expiration support—a gap in Laravel’s native solutions (e.g., signed routes lack built-in TTL). Could complement Laravel’s signed helpers or Cache facade for token validation.symfony/http-foundation).Request/UriSigner with Laravel’s ecosystem (e.g., middleware, service providers).HttpFoundation (v6.0+) for Request/UriSigner.UriSigner classes or existing middleware.symfony/http-foundation (~1MB) may bloat projects not already using Symfony. Alternatives like paragonie/url-validator exist but lack expiration logic.SECRET_KEY (base64-encoded HMAC-SHA1). Risk: Weak hashing (SHA-1) and hardcoded secrets. Mitigation: Override getSecret() or configure a stronger key (e.g., openssl_random_pseudo_bytes()).expires + 5 minutes).filter_var($uri, FILTER_VALIDATE_URL).signed routes, or supplement them (e.g., for non-route URIs like S3 presigned URLs)?ExpiredLinkException) be caught globally (e.g., in middleware) or delegated to business logic?UriSigner vs. Laravel’s Cache::remember.symfony/http-foundation (e.g., via laravel/symfony-bridge or spatie/laravel-symfony-support).UriSigner to Laravel’s container, wrapping Symfony’s Request:
$this->app->bind(UriSigner::class, function ($app) {
return new UriSigner($app->make('request')->getUri());
});
SignedUriMiddleware).sign()/check() methods.signed routes or Cache::put() + Str::random().Str::random(40)) with UriSigner.signed routes if using this for expiration.Hash facade and Cache.symfony/http-foundation:^6.0.UriSigner class).composer require code4nix/uri-signer.secret): php artisan vendor:publish --tag=uri-signer.SECRET_KEY (e.g., in .env):
URI_SIGNER_SECRET=base64:$(openssl rand -base64 32)
UriSigner if needed (e.g., for custom secret sources).use Code4Nix\UriSigner\UriSigner;
$signer = app(UriSigner::class);
$signedUrl = $signer->sign('https://example.com/file.pdf', 3600); // 1 hour
if (!$signer->checkRequest(request())) {
abort(403);
}
if (!$signer->check($uri, true)) {
throw new \Code4Nix\UriSigner\Exception\ExpiredLinkException();
}
sign()/check() with edge cases (expired, malformed URIs).HttpTests.symfony/http-foundation for breaking changes (e.g., Symfony 7.0+).code4nix/uri-signer if new features are added (e.g., algorithm support).SECRET_KEY periodically (e.g., via Laravel Forge/Envoyer)..env or Vault.MalformedUriException, ExpiredLinkException).SECRET_KEY).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Secret leakage | URIs can be forged | Use strong secrets, rotate frequently |
| Clock skew (server/client) | False expirations/rejections | Add 5–10 min buffer to expiration |
| Malformed URI input | Silent failures or exceptions | Validate URIs with filter_var() |
| Symfony dependency breakage | Integration fails | Fork or |
How can I help you explore Laravel packages today?