yoho/aliyun-sdk

SDK for aliyun service develop base on axios

0.5.5 2018-04-02 07:18 UTC

This package is not auto-updated.

Last update: 2022-05-19 05:46:36 UTC


README

The set of Aliyun Cloud Service SDK ,Support for composer library.

Latest Stable Version License

Aliyun Cloud OSS official documentation center

Env

  • PHP 7.0+.
  • CURL extension.

Install

composer require axios/aliyun-sdk

Development Plan

  • VOD -> Done
  • CDN -> Done
  • OSS -> Base on aliyun/aliyun-oss-php-sdk
  • SMS -> base on flc/dysms
  • MTS -> Done
  • ECS -> in development
  • APIGateway -> in development
  • ......

How To Use

  • require composer autoload
require_once __DIR__. "/../vendor/autoload.php";
  • auth
$access_id = "testAccessKeyId";
$access_secret = "testAccessKeySecret";

\aliyun\sdk\Aliyun::auth($access_id,$access_secret);
  • Setting Region
\aliyun\sdk\Aliyun::region('cn-shanghai');
  • Request
$response = \aliyun\sdk\vod\Vod::GetCategories()
    ->setCateId(-1)
    ->setPageNo(4)
    ->setPageSize(10)
    ->request();

// Or Request like this
$request = \aliyun\sdk\vod\Vod::GetCategories();
$request->setCateId(-1);
$request->setPageNo(4);
$request->setPageSize(10)
$response = $request->request();
  • Get Response Content
dump($response->getContent());

Customized Request

use aliyun\sdk\vod\request\VodCommon;

class Example extends VodCommon {
    public function doSomething(){
        //setting Action
        $this->setActionName("action_name");
        
        //setting parameter
        $this->setParam("param_name","param_value");
        
        return $this->request();
    }
}

License

licensed under the Apache License 2.0