简体   繁体   中英

Integrating AWS SDK as a library in Codeigniter

Is there already a handy CI 2 library for AWS SDK 1.5.x? If not, what would be the steps to make it into one?

I found a 3 year old posting about integrating Tarzan (the pre-pre-cursor to AWS SDK) to CI 1 here: http://blog.myonepage.com/integrating-tarzan-amazon-web-services-php-to . I am wondering if these instructions still hold? One difference I noticed was that the way AWS SDK 1.5.3 declares its Access Identifiers has changed and I am not quite sure how to proceed to inform CI about this.

Thanks! mmiz

The blog post you linked is still basically valid, here's what exactly you need to do:

First put SDK into subfolder inside libraries folder (for ex. aws-sdk-for-php). This is the file awslib.php in libraries folder:

class Awslib {

    function Awslib()
    {
        require_once('aws-sdk-for-php/sdk.class.php');
    }
}

And then just use whatever AWS service you wish in the controller, let's say it's SQS:

    $this->load->library('awslib');
    $sqs = new AmazonSQS();
    $response = $sqs->list_queues();
    var_dump($response->isOK());

Don't forget to set your credentials and rename the sample config file.

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