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

v0.1.1 2026-02-15 07:23 UTC

This package is not auto-updated.

Last update: 2026-02-18 19:22:33 UTC


README

PHP Version License Build Status codecov

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

๐Ÿ“ˆ 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