Giter VIP home page Giter VIP logo

cakephp-amazon-aws-sdk's Introduction

Amazon SDK version 2 plugin for CakePHP 2.0+

This plugin is a (very) thin veil over Amazon's AWS SDK for PHP for use in CakePHP controllers. Forked from many others but upgraded to support new sdk 2 and removed sdk Vendor from the plugin for a more composer-compatible installation.

Warning: the new sdk is very different. Old code may no longer work.

Installation

  • Add to composer, this will also install the Amazon SDK for PHP as a dependency

      "ali1/cakephp-amazon-aws-sdk": "dev-master"
    
  • Add the component to a controller

      public $components = array('Amazonsdk.Amazon');
    

Configuration

You must add configuration to bootstrap.php.

	Configure::write('Amazonsdk.credentials', array(
		'key' => 'YOUR KEY',
		'secret' => 'YOUR SECRET',
		'region' => 'us-east-1'
	));

Don't forget to replace the placeholder text with your actual keys!

Usage

At this point you have access to all of the methods available from the AWS SDK. The following is a small list. The full list can be found at (http://docs.aws.amazon.com/aws-sdk-php/latest/namespace-Aws.html).

  • Amazon CloudFront
  • Amazon CloudWatch
  • Amazon DynamoDB
  • Amazon ElastiCache
  • Amazon Elastic Compute Cloud (Amazon EC2)
  • Amazon Elastic MapReduce
  • Amazon Relational Database Service (Amazon RDS)
  • Amazon Simple Notification Service (Amazon SNS)
  • Amazon Simple Queue Service (Amazon SQS)
  • Amazon Simple Storage Service (Amazon S3)
  • Amazon Simple Workflow Service
  • Amazon SimpleDB
  • Amazon Simple Email Service
  • Amazon Virtual Private Cloud (Amazon VPC)
  • Auto Scaling
  • AWS CloudFormation
  • AWS Elastic Beanstalk
  • AWS Import/Export
  • AWS Identity and Access Management
  • Elastic Load Balancing

Not all of the methods for each service has been thoroughly tested. If you run into any issues, feel free to open an issue here, on the repository.

The specific objects for each service can be accessed through the component as a member of it. Here are some examples:

  • $this->Amazon->Sns
  • $this->Amazon->CloudFront
  • $this->Amazon->CloudWatch
  • $this->Amazon->Ec2
  • $this->Amazon->ElasticBeanstalk
  • $this->Amazon->Sqs

Example

  • Add a job to the SQS queue

      $this->Amazon->Sqs->sendMessage(array(
      	'QueueUrl' => Configure::read('SQS.queueUrl'),
      	'MessageBody' => json_encode(array('jobtype'=>'SendEmails', 'data'=>array('id' => 5)))
      ));
    
  • From a model or shell

      if (!isset($this->Amazon)) {
      	App::import('Component', 'Amazonsdk.Amazon');
      	$collection = new ComponentCollection();
      	$Controller =& new Controller();
      	$this->Amazon = new AmazonComponent($collection);
      	$this->Amazon->initialize($Controller);
      }
      $this->Amazon->Sqs->sendMessage(array(
      	'QueueUrl' => Configure::read('SQS.queueUrl'),
      	'MessageBody' => json_encode(array('jobtype'=>'SendEmails', 'data'=>array('id' => 5)))
      ));
    

Notes

cakephp-amazon-aws-sdk's People

Contributors

ali1 avatar fukayatsu avatar joebeeson avatar mcallisto avatar paul-wagner avatar pekeq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cakephp-amazon-aws-sdk's Issues

Doesn't work at all

Running composer install installs the SDK and dependencies, but not the component. Installing the component manually, then trying to use it, all SDK method are undefined...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.