Skip to content
This repository has been archived by the owner on Jan 6, 2019. It is now read-only.

KasselerCMS/config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Config Component

Build Status Scrutinizer Code Quality Latest Stable Version Total Downloads Latest Unstable Version License

Config Component is a file configuration loader and saver that supports PHP, XML, JSON, and YAML files.

Requirements

  • PHP >= 5.4
  • symfony/yaml

Installation

$ composer require kasseler/config

Usage

Initialization Yaml configuration

$config = new Repository(new YamlFileReader(), new YamlFileWriter(), __DIR__.'/app/config/');

Initialization XML configuration

$config = new Repository(new XmlFileReader(), new XmlFileWriter(), __DIR__.'/app/config/');

Initialization JSON configuration

$config = new Repository(new JsonFileReader(), new JsonFileWriter(), __DIR__.'/app/config/');

Initialization PHP array configuration

$config = new Repository(new ArrayFileReader(), new ArrayFileWriter(), __DIR__.'/app/config/');

$config
    ->set('database.host', 'localhost')
    ->set('database.user', 'root')
    ->set('database.password', '')
    ->set('database.database', 'config')
    ->write();
    
$config->get('database.host');