Integrating AWS SDK as a library in Codeigniter

前端 未结 2 1550
情书的邮戳
情书的邮戳 2021-02-03 16:08

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

2条回答
  •  执笔经年
    2021-02-03 16:53

    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.

提交回复
热议问题