sonrisa / filereader-component
FileReader component for sonrisa framework. Build for PHP5.3 and above.
Installs: 7 638
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.3.3
- sonrisa/factory-component: >=1.0.0
- sonrisa/filesystem-component: >=1.0.0
- symfony/yaml: 2.4.*@dev
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2018-01-08 08:17:28 UTC
README
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ó