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']
];
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.
You can use the same syntax used for S3 disk.
Storage::disk('local')->temporaryUrl('file.txt', now()->addMinutes(5));
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',
]
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.