PHP code example of farhan928 / yii2-aws-s3-client
1. Go to this page and download the library: Download farhan928/yii2-aws-s3-client 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/ */
farhan928 / yii2-aws-s3-client example snippets
// add this in your component section
's3Client' => [
'class' => 'farhan928\AwsS3\S3Client',
'key' => 'YOUR_AWS_KEY',
'secret' => 'YOUR_AWS_SECRET',
'bucket' => 'YOUR_BUKCET',
],
Yii::$app->s3Client->url('file.png');
Yii::$app->s3Client->temporaryUrl('file.png', 5); //second argument is the duration in minute
// get all files
Yii::$app->s3Client->files('path/to/your/folder/');
// get certain type of files
Yii::$app->s3Client->files('path/to/your/folder/', ['jpg', 'png']);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.