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

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

This extension provides the AWS SDK integration for the Yii2 framework

Installation ¶

The preferred way to install this extension is through composer.

Either run

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

or add

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

to the require section of your composer.json file.

Usage ¶

To use this extension, simply add the following code in your application configuration:

return [
    //....
    'components' => [
        'awssdk' => [
            'class' => 'fedemotta/awssdk/AwsSdk',
            'key' => 'yourkey',
            'secret' => 'yoursecret',
            'region' => 'yourregion',
        ],
    ],
];

Getting all balancer names from AWS:

$awssdk = Yii::$app->awssdk->getAwsSdk();
$elb = $awssdk->get('elasticloadbalancing');
$load_balancers = $elb->describeLoadBalancers()->toArray();
if (isset($load_balancers['LoadBalancerDescriptions'])){
    foreach ($load_balancers['LoadBalancerDescriptions'] as $balancer){
        if (isset($balancer['LoadBalancerName'])){ 
            echo $balancer['LoadBalancerName'];
        }
    }
}
Resources ¶
0 0
1 follower
0 downloads
Yii Version: 2.0
License: MIT
Category: Web Service
Developed by: fedemotta fedemotta
Created on: Apr 16, 2015
Last updated: 10 years ago

Related Extensions