1. Go to this page and download the library: Download akaunting/signed-url library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
return [
/*
* This string is used the to generate a signature. You should
* keep this value secret.
*/
'signatureKey' => env('APP_KEY'),
/*
* The default expiration time of a URL in days.
*/
'default_expiration_time_in_days' => 1,
/*
* These strings are used a parameter names in a signed url.
*/
'parameters' => [
'expires' => 'expires',
'signature' => 'signature',
],
/*
|--------------------------------------------------------------------------
| Middleware
|--------------------------------------------------------------------------
|
| This option indicates the middleware to change language.
|
*/
'middleware' => 'Akaunting\SignedUrl\Middleware\ValidateSignedUrl',
];
//the generated URL will be valid for 5 days.
SignedUrl::sign('https://myapp.com/protected-route', 5);
//This URL will be valid up until 2 hours from the moment it was generated.
SignedUrl::sign('https://myapp.com/protected-route', Carbon\Carbon::now()->addHours(2) );