verystar/aliyun-acm

The aliyun ACM SDK for php

v1.0.3 2018-11-07 02:27 UTC

This package is auto-updated.

Last update: 2024-04-22 01:30:13 UTC


README

Build Status Total Downloads Latest Stable Version

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

Install

composer require fifsky/aliyun-acm

Or add a dependency to the composer.json

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

Run

composer update

Usage

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);

Exception

If the API request fails, an throw exception is RequestException

use Aliyun\ACM\RequestException;

try{
    $ret = $client->getConfig("test","DEFAULT_GROUP");
    print_r($ret);    
}catch (RequestException $e){
    print_r($e);   
}

License

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