beicroon / apollo-php-client
The [ctripcorp/apollo] client for php.
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 1 048
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^7.4
- ext-json: *
- guzzlehttp/guzzle: ^6.0
This package is auto-updated.
Last update: 2021-06-30 11:10:20 UTC
README
安装
composer require beicroon/apollo-php-client
使用
use Beicroon\ApolloClient; use GuzzleHttp\Exception\GuzzleException; $server = 'http://127.0.0.1:8080'; $appId = 'your-app-id'; $namespaces = ['common', 'application']; $client = ApolloClient::make($server, $appId, $namespaces) ->setCluster('default') ->setClientIp('127.0.0.1'); $env = __DIR__.DIRECTORY_SEPARATOR.'.env'; while (true) { try { if ($client->listen($env)) { // success } } catch (GuzzleException $exception) { // http error } sleep(60); }