iamfredric / spaces
Signs url for uploading files to DigitalOcean spaces
Installs: 29
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:package
Requires
- php: ^8.0|^7.4
- aws/aws-sdk-php: ^3.173
Requires (Dev)
- mockery/mockery: ^1.4
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-12-23 13:06:46 UTC
README
Table of contents
- Requirements
- What is this
- How do I use it?
- Laravel integration
- Contributing
Requirements
You will need to use php 7.4 or above.
What's this?
This is a simple package for signing urls for uploads to DigitalOcean Spaces and AWS s3.
How do I use it?
composer require iamfredric/spaces
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();
How do I use it with Laravel?
This one ships ready for Laravel.
composer require iamfredric/spaces
The configurations is per default set to filesystems.disks.s3 if you want to use anyother configurations, define this in filesystem.spaces_key. The required params is region, endpoint, key, secret, and bucket
use Illuminate\Http\Request; use Iamfredric\Spaces\Spaces; class StorageController { public function sign(Spaces $spaces) { return response($spaces->sign(), 201); } }