Multi-format configuration system with unified dot-notation access for CxLLM Studio.
CxConfig provides a unified interface for loading configuration from PHP arrays, INI files, JSON, YAML, and Perl-syntax config files. Access any value with dot-notation (config('database.host')) regardless of the underlying format.
| File | Purpose |
|---|---|
ConfigManager.php |
Central config facade — dot-notation access, caching, env override |
ConfigInterface.php |
Contract for all config implementations |
| Parsers | |
Parser/PhpArrayParser.php |
Native PHP array config files (.php) |
Parser/IniParser.php |
INI/conf/cfg files with section support |
Parser/JsonParser.php |
JSON configuration files |
Parser/YamlParser.php |
YAML configuration (requires symfony/yaml) |
Parser/PerlParser.php |
Perl-syntax config files (.pl, .pm, .conf) |
| Adapters | |
Adapter/PearConfigAdapter.php |
PEAR Config compatibility layer |
Adapter/PerlConfigAdapter.php |
Perl CxAI::CxPHP::Config bridge adapter |
| Exceptions | |
Exception/ConfigException.php |
Configuration errors |
Exception/ParseException.php |
Format-specific parse failures |
┌──────────────────┐
│ ConfigManager │
│ (dot-notation) │
└────────┬─────────┘
│ auto-detect
┌────────┬───────┼───────┬────────┐
▼ ▼ ▼ ▼ ▼
┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐
│ PHP │ │ INI │ │ JSON │ │ YAML │ │ Perl │
│Parser│ │Parser│ │Parser│ │Parser│ │Parser│
└──────┘ └──────┘ └──────┘ └──────┘ └──────┘
▲ ▲
│ Adapters │
┌───┴──────┐ ┌───────┴────┐
│ PEAR │ │ Perl │
│ Adapter │ │ Adapter │
└──────────┘ └────────────┘
use CxAI\CxPHP\Config\ConfigManager;
$config = new ConfigManager('/path/to/config');
// Auto-detects format by extension
$config->load('database.php'); // PHP array
$config->load('services.ini'); // INI
$config->load('studio.conf'); // Perl-syntax
// Unified dot-notation access
$host = $config->get('database.host', 'localhost');
$port = $config->get('database.port', 3306);
// Env vars take precedence
// DATABASE_HOST=prod-db.example.com overrides config('database.host')- PHP 8.0+ (8.3 recommended)
- Optional:
symfony/yamlfor YAML config support
CxAI\CxPHP\Config\
PSR-4 autoloading: CxAI\CxPHP\Config\ → src/Config/
| Repository | Description |
|---|---|
| CxPHP | PHP 8.3 ACP Gateway (monorepo) |
| CxPerl | Perl CxAI::CxPHP::Config (bridged via adapter) |
| CxCluster | Cluster orchestration (config consumer) |
| CxNode | Node.js SDK (config consumer) |