Download the PHP package leeqvip/php-apollo without Composer
On this page you can find all versions of the php package leeqvip/php-apollo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package php-apollo
PHP Apollo Client
A comprehensive PHP client for Apollo configuration center, supporting configuration retrieval, real-time updates, local caching, and multiple configuration formats.
Features
- ✅ PHP 8.0+ support with strict type declarations
- ✅ Singleton pattern design
- ✅ Multiple namespace support
- ✅ Real-time configuration updates (long polling)
- ✅ Local cache support with fallback mechanism
- ✅ Configuration change callbacks
- ✅ Dot-notation configuration key support
- ✅ Multiple configuration format support (YAML, JSON, Properties)
- ✅ Authentication mechanism (HMAC-SHA1 signature)
- ✅ Exception-based error handling
- ✅ GuzzleHTTP-based HTTP client
- ✅ PSR-4 autoloading standard
Installation
Install via Composer:
Quick Start
Basic Usage
Listening for Configuration Changes
Multiple Namespaces
Configuration Options
| Option | Type | Default Value | Description |
|---|---|---|---|
| app_id | string | '' | Application ID |
| server_url | string | 'http://localhost:8080' | Apollo server address |
| cluster | string | 'default' | Cluster name |
| namespaces | array | ['application'] | Namespace list |
| cache_dir | string | sys_get_temp_dir() . '/apollo' | Cache directory |
| secret | string | '' | Authentication secret key |
Supported Configuration Formats
The client automatically detects and parses different configuration formats based on the namespace suffix:
| Format | Suffix | Example Namespace |
|---|---|---|
| Properties | .properties | application.properties |
| YAML | .yml, .yaml | application.yml, config.yaml |
| JSON | .json | config.json |
| Default (Properties) | No suffix | application |
Troubleshooting
Common Issues
-
401 Unauthorized Error
- Check if your
secretkey is correct - Ensure the server time is synchronized (time skew error)
- Verify that the application has permission to access the namespace
- Check if your
-
404 Not Found Error
- Check if the Apollo server address is correct
- Verify that the application ID exists in Apollo
- Ensure the specified namespace exists
- Configuration Not Updating
- Check if the long polling is working correctly
- Verify that the cache directory is writable
- Ensure the namespace suffix matches the expected format
Dependencies
- PHP >= 8.0
- guzzlehttp/guzzle >= 7.6
- (Optional) symfony/yaml >= 5.0 (for YAML parsing)
License
MIT License
All versions of php-apollo with dependencies
PHP Build Version
Package Version
The package leeqvip/php-apollo contains the following files
Loading the files please wait ...