yetanother / config
Yet another php configuration tool
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/yetanother/config
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-09-23 10:01:35 UTC
README
YetAnother Config — простой менеджер конфигурационных файлов.
Установка
Рекомендуемая установка через composer:
{ "require": { "yetanother/config": "dev-master" } }
Одиночный конфигурационный файл
// path/to/config.php return array( 'parameter1' => 'value1', 'parameter2' => 'value2' );
use YetAnother\Config\Config; $config = new Config('path/to/config.php'); echo $config['parameter1']; // value1
Директория с конфигурационными файлами
config
┕database.php
┕routing.php
┕security.php
use YetAnother\Config\Config; $config = new Config('path/to/config'); echo $config['database']['host'];
Использование переменных вместо массива
// path/to/config.php $parameter1 = 'value1'; $parameter2 = 'value2';
use YetAnother\Config\Config; $config = new Config('path/to/config.php'); echo $config['parameter1'];
Включение других конфигурационных файлов
config
┕config.php
┕database.php
┕routing.php
┕security.php
// config.php $database = include(__DIR__.'/database.php'); $routing = include(__DIR__.'/routing.php'); $security = include(__DIR__.'/security.php'); // или $database = $this->import('database'); $routing = $this->import('routing'); $security = $this->import('security'); // или $database = $this->import(__DIR__.'/database.php'); $routing = $this->import(__DIR__.'/routing.php'); $security = $this->import(__DIR__.'/security.php');
use YetAnother\Config\Config; $config = new Config('config/config.php'); echo $config['database']['host'];