phpone / yii2-apollo
yii2-apollo client
Installs: 14
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=7.0.0
- lackhurt/apollo-client: ^0.1.4
- yiisoft/yii2: ^2.0
This package is auto-updated.
Last update: 2025-03-15 20:33:23 UTC
README
Instruction
- install
composer require phpone/yii2-apollo
- change .env file
APP_ID=1 CLUSTER=default APOLLO_NAMESPACES="application,hogwarts.common_snape_config" APOLLO_COMMON_NAMESPACE="hogwarts.common_snape_config" APOLLO_CONFIG_SERVER=127.0.0.1
- add configuration in console.php & web.php
[ 'aliases' => [ '@storagePath' => '@app/storage', '@apolloPath' => '@storagePath/apollo' ] ];
- add configuration in console.php
[ 'controllerMap' => [ 'apollo.start-agent' => [ 'class' => 'Wby\ApolloYii\commands\ApolloClientController', 'namespaces' => explode(',', getenv('APOLLO_NAMESPACES', 'application')), 'cluster' => getenv('APOLLO_CLUSTER', 'default'), 'save_dir' => '@apolloPath', 'config_server' => getenv('APOLLO_CONFIG_SERVER', 'http://192.168.100.184:8090'), 'app_id' => getenv('APP_ID'), 'timeout_interval' => 70 ] ] ];
use
- exec ./yii apollo.start-agent , if you want to keep the script run in daemon can see http://supervisord.org/
- how get config
$namespace = 'application'; $key = 'host'; $host = Apollo::connect($namespace)->get($key);