1. Go to this page and download the library: Download phptars/tars-config 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/ */
phptars / tars-config example snippets
g = new \Tars\client\CommunicatorConfig();
$config->setLocator("tars.tarsregistry.QueryObj@tcp -h 172.16.0.161 -p 17890"); //The configuration here is the tar master address
$config->setModuleName("tedtest"); //The primary call name is used to display the secondary primary call report.
$config->setCharsetName("UTF-8"); //character set
$conigServant = new \Tars\config\ConfigServant($config);
$result = $conigServant->loadConfig("PHPTest",'helloTars','hhh.txt',$configtext); //The parameters are appName (service name part I), server name (service name part II), file name, and the last is reference parameter, which is the content of the output configuration file.
var_dump($configtext);
$config->setSocketMode(2); // setup socket model为2 swoole tcp client,1为socket,3为swoole protocol client
$conigServant = new \Tars\config\ConfigServant($config);
$result = $conigServant->loadConfig("PHPTest",'helloTars','hhh.txt',$configtext);
var_dump($configtext);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.