项目作者: fifsky

项目描述 :
Aliyun ACM SDK for PHP
高级语言: PHP
项目地址: git://github.com/fifsky/aliyun-acm.git
创建时间: 2018-07-03T14:18:11Z
项目社区:https://github.com/fifsky/aliyun-acm

开源协议:MIT License

下载


Aliyun-ACM SDK for PHP

Build Status
Total Downloads
Latest Stable Version

Aliyun ACM SDK for PHP, Multi-ip polling and local file cache is supported

Install

  1. composer require fifsky/aliyun-acm

Or add a dependency to the composer.json

  1. "require": {
  2. "fifsky/aliyun-acm": "1.0.*"
  3. }

Run

  1. composer update

Usage

  1. use Aliyun\ACM\Client;
  2. $client = new Client([
  3. "accessKey"=>"***********",
  4. "secretKey"=>"***********",
  5. "endPoint"=>"acm.aliyun.com",
  6. "nameSpace"=>"***********",
  7. "timeOut"=>30, //long pull timeout default 30s
  8. ]);
  9. //get config
  10. $ret = $client->getConfig("test","DEFAULT_GROUP");
  11. print_r($ret);
  12. //subscribe
  13. $ret = $client->subscribe("test","DEFAULT_GROUP");
  14. print_r($ret);
  15. //pulish
  16. $ret = $client->publish("test","DEFAULT_GROUP","config content");
  17. print_r($ret);
  18. //remove config
  19. $ret = $client->delete("test","DEFAULT_GROUP");
  20. print_r($ret);
  21. //get all config by tenant
  22. $ret = $client->getAllConfigs(1,1);
  23. print_r($ret);

Exception

If the API request fails, an throw exception is RequestException

  1. use Aliyun\ACM\RequestException;
  2. try{
  3. $ret = $client->getConfig("test","DEFAULT_GROUP");
  4. print_r($ret);
  5. }catch (RequestException $e){
  6. print_r($e);
  7. }

License

The SDK is open-sourced software licensed under the MIT license.