1. Go to this page and download the library: Download leeqvip/php-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/ */
leeqvip / php-apollo example snippets
eeqvip\Apollo\Apollo;
// Initialize Apollo client
$apollo = Apollo::getInstance([
'app_id' => 'YOUR_APP_ID',
'server_url' => 'http://localhost:8080', // Apollo server address
'cluster' => 'default', // Cluster name
'namespaces' => ['application'], // Namespace list
'cache_dir' => __DIR__ . '/cache', // Cache directory
'secret' => 'YOUR_SECRET',
]);
$apollo->load();
// Get configuration
$value = $apollo->get('key', 'default');
echo "Configuration value: $value\n";
// Get all configurations
$configs = $apollo->getAll();
print_r($configs);