jotaelesalinas/php-rwgen

Read/write generators in PHP

v0.5.1 2018-11-15 22:15 UTC

This package is auto-updated.

Last update: 2024-11-12 19:22:21 UTC


README

Latest Version on Packagist Software License Build Status Total Downloads

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 Readers and Writers

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.