2017 © Pedro Peláez
 

library rdn-csv

Zend Framework 2/3 module to export and import CSV files

image

radnan/rdn-csv

Zend Framework 2/3 module to export and import CSV files

  • Sunday, April 29, 2018
  • by radnan
  • Repository
  • 2 Watchers
  • 20 Stars
  • 56,648 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 18 Forks
  • 3 Open issues
  • 4 Versions
  • 4 % Grown

The README.md

RdnCsv

The RdnCsv Laminas module makes it really easy to export and import CSV files., (*1)

How to install

  1. Use composer to require the radnan/rdn-csv package:, (*2)

    $ composer require radnan/rdn-csv:3.*
    
  2. Activate the module by including it in your application.config.php file:, (*3)

    <?php
    
    return array(
       'modules' => array(
           'RdnCsv',
           // ...
       ),
    );
    

How to use

The module comes with two plugins - CsvExport() and CsvImport()., (*4)

CsvExport()

Export data into a downloadable CSV file using this plugin., (*5)

// inside a controller action

$header = array(
    'Year',
    'Make',
    'Model',
    'Description',
    'Price',
);
$records = array(
    array(
        '1997',
        'Ford',
        'E350',
        'ac, abs, moon',
        '3000.00',
    ),
);

return $this->CsvExport('foo.csv', $header, $records);

The plugin will return a response object which you can then return from your controller action., (*6)

Read more documentation on CsvExport(), (*7)

CsvImport()

Import data from a CSV file using this plugin., (*8)

// inside a controller action

$csv = $this->CsvImport('/path/to/foo.csv');

foreach ($csv as $row)
{
    var_dump($row);
    // array(
    //     'Year' => '1997',
    //     'Make' => 'Ford',
    //     'Model' => 'E350',
    //     'Description' => 'ac, abs, moon',
    //     'Price' => '3000.00',
    // )
}

The plugin returns an iterator that can be used to loop over all the rows in the CSV file., (*9)

Read more documentation on CsvImport(), (*10)

The Versions

29/04 2018

dev-master

9999999-dev

Zend Framework 2/3 module to export and import CSV files

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar radnan

csv zf2 zend export zendframework zf3 import

29/04 2018

v2.0.0

2.0.0.0

Zend Framework 2/3 module to export and import CSV files

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar radnan

csv zf2 zend export zendframework zf3 import

19/04 2014

v1.1.0

1.1.0.0

Zend Framework 2 module to export and import CSV files

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar radnan

csv zf2 zend export import

26/12 2013

v1.0.0

1.0.0.0

Zend Framework 2 module to export and import CSV files

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar radnan

csv zf2 zend export import