cinghie/yii2-aws

Yii2 Amazon Web Services (AWS)

Installs: 329

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 1

Open Issues: 0

Type:yii2-extension

0.1.1 2019-04-13 17:32 UTC

This package is auto-updated.

Last update: 2024-11-09 05:48:07 UTC


README

License Latest Stable Version Latest Release Date Latest Commit Total Downloads

Yii2 AWS (Amazon Web Services) implementing Amazon AWS SDK for PHP

Features

Installation

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require cinghie/yii2-aws "*"

or add

"cinghie/yii2-aws": "*"

Configuration

Add in your common configuration file:

use cinghie\aws\components\AWS;
use cinghie\aws\AWS as AWSModule;

'components' => [

    'aws' => [
    	'class' => AWS::class,
    	'accessKey' => 'AMAZON_ACCESS_KEY',
    	'secretKey' => 'AMAZON_SECRET_KEY',
    	'region' => 'eu-west-1',
    	'version' => 'latest'
    ],
    
],

'modules' => [

	'aws' => [
		'class' => AWSModule::class,
		'awsRoles' => ['admin'],
	],

],

Overrides

Override controller example, on modules config

'modules' => [ 
	
	'aws' => [ 
		'class' => AWS::class,
		'controllerMap' => [
			's3' => 'app\controllers\S3Controller',
			'ses' => 'app\controllers\SesController',
		]
	]
	
],

Override models example, on modules config

'modules' => [ 
	
	'aws' => [ 
		'class' => AWS::class,
		'modelMap' => [
			'S3' => 'app\models\S3',
			'SES' => 'app\models\SES',
		]
	]
	
],

Override view example, on components config

'components' => [ 

	'view' => [
		'theme' => [
			'pathMap' => [
				'@cinghie/aws/views/s3' => '@app/views/aws/s3',
				'@cinghie/aws/views/ses' => '@app/views/aws/ses',
			],
		],
	],
	
],

Filters

If you have a Yii2 App Advanced (frontend/backend) you can exclude frontend actions

use cinghie\articles\filters\FrontendFilter as AwsFrontendFilter;

'modules' => [ 
	
	'aws' => [ 
		'class' => AWS::class,
		'as frontend' => AwsFrontendFilter::class,
	]
	
],