PHP code example of iamfredric / spaces

1. Go to this page and download the library: Download iamfredric/spaces 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/ */

    

iamfredric / spaces example snippets


use \Aws\S3\S3Client;
use Iamfredric\Spaces\Spaces;

$s3 = new S3Client([
    'version' => 'latest',
    'region'  => 'ENTER_REGION',
    'endpoint' => 'ENTER_ENDPOINT',
    'credentials' => [
        'key'    => 'ENTER_KEY',
        'secret' => 'ENTER_SECRET',
    ],
]);

$spaces = new Spaces($s3, $bucket = 'bucket');

// You would want to return this response
$response = $spaces->sign();

use Illuminate\Http\Request;
use Iamfredric\Spaces\Spaces;

class StorageController
{
    public function sign(Spaces $spaces)
    {
        return response($spaces->sign(), 201);
    }
}