PHP code example of irap / aws-wrapper

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

    

irap / aws-wrapper example snippets




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

$awsWrapper = new \iRAP\AwsWrapper\AwsWrapper(
    AWS_KEY,
    AWS_SECRET,
    iRAP\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',
    iRAP\AwsWrapper\S3\Acl::createAuthenticatedRead(),
    iRAP\AwsWrapper\S3\StorageClass::createStandard()
);

bash
sudo apt-get install php-xml