PHP code example of phpone / yii2-apollo

1. Go to this page and download the library: Download phpone/yii2-apollo 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/ */

    

phpone / yii2-apollo example snippets


[
    'aliases' => [
        '@storagePath' => '@app/storage',
        '@apolloPath' => '@storagePath/apollo'
    ]
];

[
    '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
        ]
    ]
];
    

$namespace = 'application';
$key = 'host';
$host = Apollo::connect($namespace)->get($key);