abrardev / laravel-local-temporary-url
Quickly add support for temporary url for local filesystem drivers
Installs: 14 108
Dependents: 0
Suggesters: 0
Security: 0
Stars: 20
Watchers: 2
Forks: 2
Open Issues: 2
Requires
- php: ^8.1|^8.2
- illuminate/contracts: ^10.0|^11.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^9.0.0||^8.22.0
- pestphp/pest: ^2.34
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-laravel: ^2.3
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
- spatie/laravel-ray: ^1.35
This package is auto-updated.
Last update: 2025-03-08 07:15:34 UTC
README
Installation
You can install the package via composer:
composer require abrardev/laravel-local-temporary-url
You can publish the config file with:
php artisan vendor:publish --tag="local-temporary-url-config"
This is the contents of the published config file:
return [ 'disk' => ['local'], 'middleware' => ['web', 'signed'] ];
Usage
Configuration
This package needs zero configuration, just install and it's good to go. However, if your local disk is different or you want to add another disk, you can configure it. You can add multiple local disks in the config using the disk
key.
The package applies web
and signed
middleware on routes by default, however, you can configure middleware(s) using the middleware
key.
Generate Temporary URL
You can use the same syntax used for S3 disk.
Storage::disk('local')->temporaryUrl('file.txt', now()->addMinutes(5));
Pass Parameters
You can pass parameters to the temporaryUrl function for ef filename.
Storage::disk('local')->temporaryUrl('file.txt', now()->addMinutes(5), ['filename' => 'customname']);
Not just file name, you can pass other options as well (with respect to disk)
[ 'ResponseContentType' => 'application/octet-stream', 'ResponseContentDisposition' => 'attachment; filename=file2.jpg', ]
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.