mardy-git/parse

Collection of parsers to parse different types of configuration files

v0.1.2 2013-06-21 13:37 UTC

README

Build Status

Collection of parsers to parse different types of configuration files

Usage

use Mardy\Parse\Parser;

//INI files
$parse = new Parser;
$file = __DIR__ . "/file.ini";
$type = "ini";

$config = $parse->parse($file, $type);

var_dump($config);

/*
Example output
[
    'one' => [
        'two' => [
            'three' => 'value',
            'four' => 'value'
        ]
    ]
];
*/

//JSON files
$parse = new Parser;
$file = __DIR__ . "/file.json";
$type = "json";

$config = $parse->parse($file, $type);

var_dump($config);
/*
Example output
[
    'one' => [
        'two' => [
            'three' => 'value',
            'four' => 'value'
        ]
    ]
];
*/

//PHP Array files
$parse = new Parser;
$file = __DIR__ . "/file.php";
$type = "array";

$config = $parse->parse($file, $type);

var_dump($config);
/*
Example output
[
    'one' => [
        'two' => [
            'three' => 'value',
            'four' => 'value'
        ]
    ]
];
*/