rabiloo / laravel-local-temporary-url
This package provides temporary url method for local filesystem driver
Requires
- php: >=8.1
- illuminate/support: ^9.0|^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^7.0|^8.0|^9.0
- phpunit/phpunit: ^9.5|^10.5|^11.0
- squizlabs/php_codesniffer: ^3.10
This package is auto-updated.
Last update: 2025-03-07 04:09:53 UTC
README
Provides temporaryUrl()
method for local filesystem driver
NOTE: Laravel 11 comes with native support for this feature. See https://laravel.com/docs/11.x/filesystem#temporary-urls This package provides the same feature for Laravel 9+ versions.
Installation
You can install the package via composer:
composer require rabiloo/laravel-local-temporary-url
Usage
Enable by config (See https://laravel.com/docs/11.x/filesystem#enabling-local-temporary-urls )
# config/filesystems.php return [ 'disks' => [ // 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), 'throw' => false, 'serve' => true, // Enable file server, default URL is `/local/temp/{path}?expires=xxx&signature=xxx` ], 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', // Enable file server with `visibility` = `public` 'throw' => false, ], // Custom local disk 'local2' => [ 'driver' => 'local', 'root' => storage_path('app/local2'), 'throw' => false, 'serve' => true, // Enable file server 'url' => 'local2/tmp', // The URL will be `/local2/tmp/{path}?expires=xxx&signature=xxx` ], //... ], ];
Make temporary URL
use Illuminate\Support\Facades\Storage; $url = Storage::disk('local')->temporaryUrl($path, now()->addSeconds(120));
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.