PHP code example of verystar / nacos-php-sdk

1. Go to this page and download the library: Download verystar/nacos-php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

verystar / nacos-php-sdk example snippets


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

composer 

"    "verystar/nacos-php-sdk": "1.0.*"
}