项目作者: AxiosCros

项目描述 :
aliyun sdk , composer library
高级语言: PHP
项目地址: git://github.com/AxiosCros/aliyun-sdk.git
创建时间: 2018-02-06T02:05:25Z
项目社区:https://github.com/AxiosCros/aliyun-sdk

开源协议:Apache License 2.0

下载


English | 简体中文

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

Latest Stable Version
License

Aliyun Cloud official documentation center

QQ Group:521797692

Env

  • PHP 7.1+.
  • CURL extension.

Install

  1. composer require axios/aliyun-sdk

Development Plan

How To Use

aliyun-sdk/example

  • require composer autoload
  1. require_once __DIR__. "/../vendor/autoload.php";
  • auth
  1. $access_id = "testAccessKeyId";
  2. $access_secret = "testAccessKeySecret";
  3. \aliyun\sdk\Aliyun::auth($access_id, $access_secret);
  • Setting Region
  1. \aliyun\sdk\Aliyun::region('cn-shanghai');
  2. // or
  3. $request = Vod::V20170321()->GetCategories();
  4. $request->region("cn-shanghai);
  5. // get region
  6. $request->region();
  • Request
  1. $response = Vod::V20170321()->GetCategories()
  2. ->setCateId(-1)
  3. ->request();
  4. // or
  5. AliyunServices::Vod20170321()->GetCategories()
  6. ->setCateId(-1)
  7. ->request();
  • Get Response Content
  1. dump($response->getContent());

Customized Request

  1. use aliyun\sdk\core\lib\Request;
  2. class Example
  3. {
  4. protected static $product = "<ProductName>";
  5. protected static $service_code = "<ProductServiceCode>";
  6. /**
  7. * @var string
  8. * @example \aliyun\sdk\core\credentials\AccessKeyCredential
  9. * @example AccessKeyCredential
  10. */
  11. protected static $credential = "<Credential>";
  12. protected static $version = "<VersionDate>";
  13. protected static $endpoints = [
  14. "regions" => [],
  15. "public" => [],
  16. "internal" => []
  17. ];
  18. /**
  19. * @param $action
  20. *
  21. * @return Request
  22. */
  23. public static function client($action = null)
  24. {
  25. $request = new Request();
  26. $request->product(self::$product);
  27. $request->version(self::$version);
  28. $request->action($action);
  29. $request->endpoints(self::$endpoints);
  30. $request->credential(self::$credential);
  31. $request->serviceCode(self::$service_code);
  32. return $request;
  33. }
  34. }
  1. $request = Example::client();
  2. $request->method("POST");
  3. $response = $request->params("key", "value")
  4. ->headers("header_name", "header_content")
  5. ->options("guzzle_option_name", "option_value")
  6. ->request();
  7. $result = $response->getContent();

Request Option

License

licensed under the Apache License 2.0