PHP code example of overlu / mini-aws
1. Go to this page and download the library: Download overlu/mini-aws 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/ */
overlu / mini-aws example snippets
'providers' => [
// ...
MiniAws\AwsServiceProvider::class,
]
return [
'credentials' => [
'key' => env('AWS_ACCESS_KEY_ID', ''),
'secret' => env('AWS_SECRET_ACCESS_KEY', ''),
],
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'version' => 'latest',
// 您可以覆盖特定服务的设置
'Ec2' => [
'region' => 'us-east-1',
],
];
$s3 = app('aws')->createClient('s3');
$s3->putObject([
'Bucket' => 'YOUR_BUCKET',
'Key' => 'YOUR_OBJECT_KEY',
'SourceFile' => '/the/path/to/the/file/you/are/uploading.ext',
]);
$s3 = \MiniAws\Facades\Aws::createClient('s3');
$s3->putObject([
'Bucket' => 'YOUR_BUCKET',
'Key' => 'YOUR_OBJECT_KEY',
'SourceFile' => '/the/path/to/the/file/you/are/uploading.ext',
]);
$s3 = \MiniAws\Facades\Aws::createS3();
$s3->putObject([
'Bucket' => 'YOUR_BUCKET',
'Key' => 'YOUR_OBJECT_KEY',
'SourceFile' => '/the/path/to/the/file/you/are/uploading.ext',
]);
sh
php bin/artisan vendor:publish --provider="MiniAws\AwsServiceProvider"