2017 © Pedro Peláez
 

yii2-extension yii2-aws-sdk

This extension provides the AWS SDK integration for the Yii2 framework

image

fedemotta/yii2-aws-sdk

This extension provides the AWS SDK integration for the Yii2 framework

  • Tuesday, November 29, 2016
  • by fedemotta
  • Repository
  • 2 Watchers
  • 12 Stars
  • 40,239 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 9 Forks
  • 1 Open issues
  • 6 Versions
  • 12 % Grown

The README.md

AWS SDK for Yii2 - Use Amazon Web Services in your Yii2 project

This extension provides the AWS SDK 3 integration for the Yii2 framework, (*1)

Latest Stable Version Total Downloads Latest Unstable Version License, (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require --prefer-dist fedemotta/yii2-aws-sdk "*"

or add, (*5)

"fedemotta/yii2-aws-sdk": "*"

to the require section of your composer.json file., (*6)

Note: You can still use AWS version 2 if you specify fedemotta/yii2-aws-sdk "1.*"

Usage

To use this extension, simply add the following code in your application configuration:, (*7)

return [
    //....
    'components' => [
        'awssdk' => [
            'class' => 'fedemotta\awssdk\AwsSdk',
            'credentials' => [ //you can use a different method to grant access
                'key' => 'your-aws-key',
                'secret' => 'your-aws-secret',
            ],
            'region' => 'your-aws-region', //i.e.: 'us-east-1'
            'version' => 'your-aws-version', //i.e.: 'latest'
        ],
    ],
];

Getting all balancer names from AWS:, (*8)

$aws = Yii::$app->awssdk->getAwsSdk();
$elb = $aws->createElasticloadbalancing();
$load_balancers = $elb->describeLoadBalancers()->toArray();
if (isset($load_balancers['LoadBalancerDescriptions'])){
    foreach ($load_balancers['LoadBalancerDescriptions'] as $balancer){
        if (isset($balancer['LoadBalancerName'])){ 
            echo $balancer['LoadBalancerName'];
        }
    }
}

Download an object from S3:, (*9)

//specify the region if it is different than the main configuration region
Yii::$app->awssdk->region = 'sa-east-1';
$aws = Yii::$app->awssdk->getAwsSdk();
//use s3
$s3 = $aws->createS3();
$result = $s3->listObjects(['Bucket' => 'your-bucket-id',"Prefix" => "your-path"])->toArray();
//get the last object from s3
$object = end($result['Contents']);
$key = $object['Key'];
$file = $s3->getObject([
    'Bucket' => 'your-bucket-id',
    'Key' => $key
]);
//download the file
header('Content-Type: ' . $file['ContentType']);
echo $file['Body'];

The Versions

29/11 2016

dev-master

9999999-dev

This extension provides the AWS SDK integration for the Yii2 framework

  Sources   Download

MIT

The Requires

 

by Federico Nicolás Motta

extension yii2 cloud amazon s3 aws sdk dynamodb ec2 glacier

10/12 2015

v2.0

2.0.0.0

This extension provides the AWS SDK integration for the Yii2 framework

  Sources   Download

MIT

The Requires

 

by Federico Nicolás Motta

extension yii2 cloud amazon s3 aws sdk dynamodb ec2 glacier

02/06 2015

v1.2

1.2.0.0

This extension provides the AWS SDK integration for the Yii2 framework

  Sources   Download

MIT

The Requires

 

by Federico Nicolás Motta

extension yii2 cloud amazon s3 aws sdk dynamodb ec2 glacier

25/04 2015

v1.1

1.1.0.0

This extension provides the AWS SDK integration for the Yii2 framework

  Sources   Download

MIT

The Requires

 

by Federico Nicolás Motta

extension yii2 cloud amazon s3 aws sdk dynamodb ec2 glacier

17/04 2015

v1.0.1

1.0.1.0

This extension provides the AWS SDK integration for the Yii2 framework

  Sources   Download

MIT

The Requires

 

by Federico Nicolás Motta

extension yii2 cloud amazon s3 aws sdk dynamodb ec2 glacier

16/04 2015

v1.0

1.0.0.0

This extension provides the AWS SDK integration for the Yii2 framework

  Sources   Download

MIT

The Requires

 

by Federico Nicolás Motta

extension yii2 cloud amazon s3 aws sdk dynamodb ec2 glacier