简体   繁体   中英

How can I use the Zend Framework and Amazon DynamoDB together?

I am using the Zend Framework and also want to use Amazon DynamoDB. I downloaded the AWS SDK for PHP and I am using this for saving data. But I don't know how to connect these two.

How can I call the AWS SDK from Zend?

I have downloaded the current SDK for php and placed it in the library directory. Structure: /library/DynamoDb/sdk-1.5.3

in your application:

Controller (above the class declaration):

require_once('DynamoDb/sdk-1.5.3/sdk.class.php');
class SomeController extends Zend_Controller_Action {

 function indexAction() {
  $MyTable = new AmazonDynamoDb();
  $all_items = $MyTable->scan();
 }
}

I suggest creating a simple ORM for easier handling.

There is also way to do it without the SDK, however, one has to figure out how to do the temporary authentication and all the signatures. The SDK is at least up to date and uses the V2 and V3 authentication.

I hope this helped.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM