WPZylos Config
Configuration repository with dot notation, environment support, and caching.
What You Get
- Config Repository — Centralized configuration access
- Dot notation — Access nested values with
config.database.host - Environment support — Override by WP_ENVIRONMENT_TYPE
- Array file loading — Standard PHP config files
- Deep merging — Merge configuration arrays recursively
Quick Start
use WPZylos\Framework\Config\ConfigRepository;
// Load config files
$config = new ConfigRepository();
$config->loadDirectory($context->path('config'));
// Access values
$debug = $config->get('app.debug', false);
$connections = $config->get('database.connections');
// Check existence
if ($config->has('cache.driver')) {
// ...
}
Config File Structure
// config/app.php
return [
'name' => 'My Plugin',
'debug' => false,
'providers' => [
AppServiceProvider::class,
],
];
Documentation
- Overview — Configuration architecture
- Installation — Setup
- Usage — Loading and accessing
- API Reference — Repository methods
- Examples — Real-world patterns
- Testing — Testing with config
- Security — Security notes
- Troubleshooting — Common issues
Related Packages
- wpzylos-core — PluginContext paths