verystar / aliyun-acm
阿里云ACM SDK for PHP
v1.0.3
2018-11-07 02:27 UTC
Requires
- php: >=5.6
Requires (Dev)
- phpunit/phpunit: ~5.7
This package is auto-updated.
Last update: 2024-09-22 02:18:47 UTC
README
阿里云ACM SDK for PHP,支持多IP轮询和本地文件缓存
安装
composer require fifsky/aliyun-acm
或者将依赖添加到composer.json文件中
"require": {
"fifsky/aliyun-acm": "1.0.*"
}
运行
composer update
用法
use Aliyun\ACM\Client; $client = new Client([ "accessKey"=>"***********", "secretKey"=>"***********", "endPoint"=>"acm.aliyun.com", "nameSpace"=>"***********", "timeOut"=>30, //long pull timeout default 30s ]); //get config $ret = $client->getConfig("test","DEFAULT_GROUP"); print_r($ret); //subscribe $ret = $client->subscribe("test","DEFAULT_GROUP"); print_r($ret); //pulish $ret = $client->publish("test","DEFAULT_GROUP","config content"); print_r($ret); //remove config $ret = $client->delete("test","DEFAULT_GROUP"); print_r($ret); //get all config by tenant $ret = $client->getAllConfigs(1,1); print_r($ret);
异常
如果API请求失败,会抛出RequestException异常
use Aliyun\ACM\RequestException; try{ $ret = $client->getConfig("test","DEFAULT_GROUP"); print_r($ret); }catch (RequestException $e){ print_r($e); }
许可证
该SDK是开源软件,使用MIT许可证授权。