nanapi/cakephp-aws-datasource

Aws DataSource Plugin for CakePHP

0.0.10 2015-03-03 06:06 UTC

README

Aws DataSource Plugin for CakePHP

Requirements

Installation

Ensure require is present in composer.json. This will install the plugin into Plugin/CakephpAwsDatasource:

{
  "require": {
    "nanapi/cakephp-aws-datasource": "v1.0.0"
  }
}

app/Config/bootstrap.php

CakePlugin::load('CakephpAwsSource');

app/Config/database.php

<?php

class DATABASE_CONFIG {

  public $aws = array(
    'datasource' => 'CakephpAwsSource.AwsSource',
    'key' => 'AWS_ACCESS_KEY_HERE',
    'secret' => 'AWS_SECRET_HERE',
  );

How to use it

your model

<?php
App::uses('AwdModel', 'CakephpAwsSource.Model');

class MyAws extends AwsModel {
}

your controller

<?php
App::uses('AppController', 'Controller');

class MyController extends AppController {
  public $uses = array(
    'MyAws';
  );

  public function index() {
    $s3 = $this->MyAws->get('s3');
    $s3->putObject(array(...));
  }
}

Methods

This is a wrapper for Guzzle\Service\Builder\ServiceBuilderInterface. For a list of methods that can be used by the Model, please refer to the Aws SDK for PHP.