Aliyun Nacos SDK for PHP
composer require verystar/nacos-php-sdk
Or add a dependency to the composer.json
"require": {
"verystar/nacos-php-sdk": "1.0.*"
}
Run
composer update
use Very\Nacos\Client;
$client = new Client([
"username"=>"***********",
"password"=>"***********",
"server_addr"=>"https://test.nacos.com",
"namespace"=>"***********",
]);
//get config
$ret = $client->getConfig("test","DEFAULT_GROUP");
print_r($ret);
//save config if config file not exists
$client->saveConfig("test","DEFAULT_GROUP","./config/db.php");
if throw NacosException,the fetch configuration failed
The SDK is open-sourced software licensed under the MIT license.