kislayphp / config
High-performance C++ PHP extension providing dynamic configuration management for PHP microservices
Installs: 1
Dependents: 0
Suggesters: 6
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Language:Shell
Type:php-ext
Ext name:ext-kislayphp_config
pkg:composer/kislayphp/config
Requires
- php: >=8.2
Suggests
- kislayphp/core: HTTP/HTTPS server foundation
- kislayphp/discovery: Service discovery integration
- kislayphp/eventbus: Real-time config change notifications
- kislayphp/gateway: Configurable API gateway
- kislayphp/metrics: Configuration metrics
- kislayphp/queue: Configurable message queuing
Provides
This package is not auto-updated.
Last update: 2026-02-18 19:22:33 UTC
README
A high-performance C++ PHP extension providing dynamic configuration management for microservices with support for multiple backends and hot-reloading. Perfect for PHP ecosystem integration and modern microservices architecture.
โก Key Features
- ๐ High Performance: Fast configuration retrieval with caching
- ๐ Hot Reloading: Dynamic configuration updates without restart
- ๐ Pluggable Backends: Support for external registry, distributed KV store, KV store, and custom clients
- ๐ Environment Integration: Automatic environment variable loading
- ๐ File Support: JSON, YAML, and INI configuration files
- ๐ง Hierarchical Config: Namespace-based configuration organization
- ๐ Monitoring: Configuration change tracking and metrics
- ๐ PHP Ecosystem: Seamless integration with PHP ecosystem and frameworks
- ๐ Microservices Architecture: Designed for distributed PHP applications
๐ฆ Installation
Via PIE (Recommended)
pie install kislayphp/config
Add to your php.ini:
extension=kislayphp_config.so
Manual Build
git clone https://github.com/KislayPHP/config.git
cd config
phpize
./configure
make
sudo make install
container
FROM php:8.2-cli
๐ Quick Start
Basic Usage
<?php // Create config instance $config = new KislayConfig(); // Set configuration values $config->set('database.host', 'localhost'); $config->set('database.port', 3306); $config->set('cache.enabled', true); // Get configuration values $host = $config->get('database.host'); // 'localhost' $port = $config->get('database.port', 3306); // 3306 (with default) $cache = $config->get('cache.enabled'); // true // Get all config as array $allConfig = $config->all(); // Check if key exists if ($config->has('database.host')) { // Key exists }
Backend Integration
<?php // Use external registry backend $config = new KislayConfig([ 'backend' => 'registry', 'registry' => [ 'host' => 'registry-server:8500', 'token' => 'your-registry-token' ] ]); // Configuration automatically loaded from external registry $appName = $config->get('app.name'); $databaseUrl = $config->get('database.url');
Environment Variables
<?php // Load from environment variables $config = new KislayConfig(); $config->loadFromEnv(); // Access environment variables $env = $config->get('APP_ENV'); // production $debug = $config->get('DEBUG', false); // false (default)
File-based Configuration
<?php // Load from JSON file $config = new KislayConfig(); $config->loadFromFile('/path/to/config.json'); // Load from YAML file $config->loadFromFile('/path/to/config.yaml'); // Load from INI file $config->loadFromFile('/path/to/config.ini');
๐ Documentation
๐ Complete Documentation - API reference, backend integrations, examples, and best practices
๐๏ธ Architecture
KislayPHP Config implements a flexible configuration system:
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Application โ โ Application โ
โ โ โ โ
โ โโโโโโโโโโโโโโโ โ โ โโโโโโโโโโโโโโโ โ
โ โ Config API โ โ โ โ Config API โ โ
โ โ (PHP) โ โ โ โ (PHP) โ โ
โ โโโโโโโโโโโโโโโ โ โ โโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโ
โ Configuration โ
โ Backends โ
โ (external registry/distributed KV store/ โ
โ KV store/Custom) โ
โโโโโโโโโโโโโโโโโโโ
๐ฏ Use Cases
- Microservices: Centralized configuration management
- Multi-environment: Different configs for dev/staging/prod
- Dynamic Updates: Runtime configuration changes
- Service Discovery: Integration with service registries
- Feature Flags: Dynamic feature toggling
- Secret Management: Secure credential storage
๐ Performance
Configuration Benchmark:
==================
Read Operations: 100,000/sec
Write Operations: 50,000/sec
Memory Usage: 8 MB
Cache Hit Rate: 95%
Average Latency: 0.05 ms
๐ง Configuration
php.ini Settings
; Config extension settings kislayphp.config.cache_size = 1000 kislayphp.config.cache_ttl = 300 kislayphp.config.enable_hot_reload = 1 kislayphp.config.reload_interval = 60 ; Backend settings kislayphp.config.backend = "memory" kislayphp.config.registry_host = "localhost:8500" kislayphp.config.distributed KV store_endpoints = "localhost:2379"
Environment Variables
export KISLAYPHP_CONFIG_BACKEND=registry export KISLAYPHP_CONFIG_REGISTRY_HOST=registry-server:8500 export KISLAYPHP_CONFIG_CACHE_SIZE=1000 export KISLAYPHP_CONFIG_HOT_RELOAD=1
๐งช Testing
# Run unit tests php run-tests.php # Test with different backends cd tests/ php test_registry_backend.php php test_distributed KV store_backend.php
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
๐ License
Licensed under the Apache License 2.0.
๐ Support
- ๐ Documentation
- ๐ Issue Tracker
- ๐ฌ Discussions
- ๐ง Security Issues
๐ Roadmap
- orchestrator config map integration
- AWS Parameter Store support
- Azure Key Vault integration
- Configuration validation schemas
- Configuration history and rollback
๐ Acknowledgments
- external registry: Service discovery and configuration
- distributed KV store: Distributed KV store
- PHP: Zend API for extension development
Built with โค๏ธ for configurable PHP applications
Installation
Via PIE
pie install kislayphp/config
Then add to your php.ini:
extension=kislayphp_config.so
Manual Build
phpize ./configure --enable-kislayphp_config make
Run Locally
cd /path/to/config
php -d extension=modules/kislayphp_config.so example.php
Custom Client Interface
Default is in-memory. To plug in KV store, MySQL, Mongo, or any other backend, provide
your own PHP client that implements KislayPHP\Config\ClientInterface and call
setClient().
Example:
$cfg = new KislayPHP\Config\ConfigClient(); $cfg->setClient(new MyConfigClient());
Example
<?php extension_loaded('kislayphp_config') or die('kislayphp_config not loaded'); $cfg = new KislayPHP\Config\ConfigClient(); $cfg->set('db.host', '127.0.0.1'); $cfg->set('db.port', '5432'); var_dump($cfg->get('db.host')); print_r($cfg->all()); ?>
SEO Keywords
PHP, microservices, PHP ecosystem, PHP extension, C++ PHP extension, PHP configuration management, dynamic PHP config, PHP hot reloading, PHP external registry, PHP distributed KV store, PHP KV store config, PHP microservices config, distributed PHP configuration