jotaelesalinas / php-rwgen
Read/write generators in PHP
v0.5.1
2018-11-15 22:15 UTC
Requires
- php: >=5.5
- league/csv: ^8.2
Requires (Dev)
- php: >=5.6
- phpunit/php-code-coverage: ^4
- phpunit/phpunit: ~4.0||~5.0
- scrutinizer/ocular: ~1.1
- squizlabs/php_codesniffer: ~2.3
README
Read/write generators in PHP.
PSR-4 compliant library to simplify reading and writing from/to files or any other endpoint within loops.
The benefits of using this library are:
- Read and write from/to many different sources using a common syntax
- Use it easily in foreach loops (readers) or any other kind of loop (writers)
- Unclutter your code by delegating the preparation and cleanup steps
Install
Via Composer
$ composer require jotaelesalinas/php-rwgen
Usage
$input = new JLSalinas\RWGen\Readers\Csv($filename_customers); $output_csv = new JLSalinas\RWGen\Writers\Csv($filename_output . '.csv'); $output_kml = new JLSalinas\RWGen\Writers\Kml($filename_output . '.kml'); foreach ( $input as $customer ) { // ...some filtering and transforming... $output_csv->send($customer_data); $output_kml->send($customer_geolocation_data); }
Creating your own Reader
s and Writer
s
Please see extending.md for more information.
Change log
Please see the CHANGELOG for more information what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email DM @jotaelesalinas instead of using the issue tracker.
To do
- Improve tests code coverage
- Add docblocks
- Fill changelog
- Travis-CI
- Use league/csv?
Credits
License
The MIT License (MIT). Please see License File for more information.