PHP code example of programster / aws-wrapper

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

    

programster / aws-wrapper example snippets




e('S3_BUCKET', 'my-bucket-name');
define('AWS_KEY', 'someKeyValueHere');
define('AWS_SECRET', 'someAwsSecretHere');

$awsWrapper = new \Programster\AwsWrapper\AwsWrapper(
    AWS_KEY,
    AWS_SECRET,
    Programster\AwsWrapper\Enums\AwsRegion::create_EU_W1()
);

# Get the S3 client for interfacing with S3, rather than EC2
$s3Client = $awsWrapper->getS3Client();

# Create a private file in S3 called "test-file.txt" that contains the text
# "hello world" in our bucket.
$response = $s3Client->createFile(
    S3_BUCKET,
    "hello world",
    'test-file.txt',
    Programster\AwsWrapper\S3\Acl::createAuthenticatedRead(),
    Programster\AwsWrapper\S3\StorageClass::createStandard()
);

bash
sudo apt-get install php-xml