pete-robinson / super-simple-config
A super-simple config parser for small projects
dev-master
2017-08-31 14:57 UTC
Requires
- php: >=5.5.0
- symfony/yaml: >=3.3.1
This package is not auto-updated.
Last update: 2025-03-08 00:30:17 UTC
README
Introduction
A super-simple configuration manager that enables easy integration with YAML based configuration files.
Pass in the configuration YAML file location and the class will parse it and make its properties avaialble to you, with dot separated levels of nesting
Usage
Create a new instance of the config class and load in the config
Example YAML Config File
config: database: host: 127.0.0.1 user: username password: password name: db_name api: google: client_id: myclientid key: xxxxxxxxx
Create a New Config Instance
<?php $file = realpath(__DIR__ . '/path/to/file.yml'); $config = new Config($file);
Fetch Config Parameters
<?php echo $config->get('path.to.parameter');
Example Based on Config File Above
<?php echo $config->get('config.database.host'); // returns 127.0.0.1 echo $config->get('config.api.google.client_id'); // returns 'myclientid'