sonrisa/filereader-component

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

FileReader component for sonrisa framework. Build for PHP5.3 and above.

1.0.0 2013-08-21 17:44 UTC

This package is not auto-updated.

Last update: 2018-01-08 08:17:28 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

The FileReader Component provides different ways to read configuration files using a common interface.

1. Installation

Add the following to your composer.json file :

"sonrisa/filereader-component":"dev-master"

2. Supported formats

  • .yml, .yaml
  • .xml
  • .ini
  • .json
  • .php (arrays)

3. Methods

All actions in this component are handled by the parse method of the FileReader class. All $data variable will return exactly the same array structure in all file formats.

<?php 
use \Sonrisa\Component\FileReader\FileReader as FileReader;

$data = FileReader::parse('example.json');
$data = FileReader::parse('example.xml');
$data = FileReader::parse('example.yml');
$data = FileReader::parse('example.ini');
$data = FileReader::parse('example.php');

You may check the sample files in the Resources directory.

4. Fully tested

Testing has been done using PHPUnit and Travis-CI. All code has been tested to be compatible from PHP 5.3 up to PHP 5.5 and Facebook's PHP Virtual Machine: HipHop.

5. Author

Nil Portugués Calderó