PHP code example of yuandian / webman-nacos
1. Go to this page and download the library: Download yuandian/webman-nacos 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/ */
yuandian / webman-nacos example snippets
namespace app\config;
use yuandian\Tools\attribute\Alias;use yuandian\WebmanNacos\Annotation\NacosConfiguration;
#[NacosConfiguration("datasource")]
class DatasourceConfig
{
#[Alias('host')] // 可以使用Alias注解设置别名
public string $url;
public string $username;
public string $password;
}
$config = \yuandian\Container\Container::getInstance()->get(DatasourceConfig::class);