kasseler/config

This package is abandoned and no longer maintained. No replacement package was suggested.

Configure files library

1.0.1 2015-02-26 20:38 UTC

This package is not auto-updated.

Last update: 2020-03-20 16:33:04 UTC


README

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');