PHP code example of icyboy / lumen-aws-sdk

1. Go to this page and download the library: Download icyboy/lumen-aws-sdk 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/ */

    

icyboy / lumen-aws-sdk example snippets


    $app->register(Icyboy\LumenAws\AwsServiceProvider::class);
    
    class_alias('Icyboy\LumenAws\AwsFacade', 'Aws');

return [
    'credentials' => [
        'key'    => 'YOUR_AWS_ACCESS_KEY_ID',
        'secret' => 'YOUR_AWS_SECRET_ACCESS_KEY',
    ],
    'region' => 'us-west-2',
    'version' => 'latest',
    
    // You can override settings for specific services
    'Ses' => [
        'region' => 'us-east-1',
    ],
    
    // if you use fake s3, you must used endpoint
    'endpoint' => "http://xxxx",
];

$s3 = App::make('aws')->createClient('s3');
$s3->putObject(array(
    'Bucket'     => 'YOUR_BUCKET',
    'Key'        => 'YOUR_OBJECT_KEY',
    'SourceFile' => '/the/path/to/the/file/you/are/uploading.ext',
));

$s3 = Aws::createClient('s3');
$s3->putObject(array(
    'Bucket'     => 'YOUR_BUCKET',
    'Key'        => 'YOUR_OBJECT_KEY',
    'SourceFile' => '/the/path/to/the/file/you/are/uploading.ext',
));
sh
php composer.phar update
sh
php artisan vendor:publish