axios / aliyun-sdk
SDK for aliyun service development
Installs: 1 166
Dependents: 0
Suggesters: 0
Security: 0
Stars: 17
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: >=7.1
- aliyuncs/oss-sdk-php: ~2.0
- axios/aliyun-sdk-core: ^2.1
- flc/dysms: ^1.0
README
English | 简体中文
The set of Aliyun Cloud Service SDK ,Support for composer library.
QQ Group:521797692
Env
- PHP 7.1+.
- CURL extension.
Install
composer require axios/aliyun-sdk
Development Plan
- OSS -> Base on aliyun/aliyun-oss-php-sdk
- SMS -> base on flc/dysms
- other services -> auto generate by sdk code generator
- ......
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'); // or $request = Vod::V20170321()->GetCategories(); $request->region("cn-shanghai); // get region $request->region();
- Request
$response = Vod::V20170321()->GetCategories() ->setCateId(-1) ->request(); // or AliyunServices::Vod20170321()->GetCategories() ->setCateId(-1) ->request();
- Get Response Content
dump($response->getContent());
Customized Request
use aliyun\sdk\core\lib\Request; class Example { protected static $product = "<ProductName>"; protected static $service_code = "<ProductServiceCode>"; /** * @var string * @example \aliyun\sdk\core\credentials\AccessKeyCredential * @example AccessKeyCredential */ protected static $credential = "<Credential>"; protected static $version = "<VersionDate>"; protected static $endpoints = [ "regions" => [], "public" => [], "internal" => [] ]; /** * @param $action * * @return Request */ public static function client($action = null) { $request = new Request(); $request->product(self::$product); $request->version(self::$version); $request->action($action); $request->endpoints(self::$endpoints); $request->credential(self::$credential); $request->serviceCode(self::$service_code); return $request; } }
$request = Example::client(); $request->method("POST"); $response = $request->params("key", "value") ->headers("header_name", "header_content") ->options("guzzle_option_name", "option_value") ->request(); $result = $response->getContent();
License
licensed under the Apache License 2.0