Skip to content
A simple CSV exporter
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
README.md
composer.json
composer.lock

README.md

csv-exporter

A lightweight package to export to CSV.

Installation

Install with Composer:

composer require crowles/csv-exporter

Basic Usage

Example:

<?php

include(__DIR__ . '../vendor/autoload.php');

$filepath = __DIR__ . '/reports/';
$filename = 'report_' . date('Y-m-d'); // File extensions are automatically handled.

$data = [
    0 => [
        'name' => 'Chris',
        'age'  => '25',
        'type' => 'Human'
    ],
    1 =>[
        'name' => 'Marley',
        'age' => '70',
        'type' => 'Dog', 
    ]
];

$csv  = new CSVExporter($filepath, $filename, true);
try {
    $csv->setData($data)
        ->generate()
        ->zip($filename, 'your-password-here');
} catch(\Crowles\CSVExporter\CSVException $e) {
    $log->debug($e->getMessage());
} 

Contact

Contact me@rowles.ch for any issues :)

License

CSV Exporter is open-sourced software licensed under the GPL license.

You can’t perform that action at this time.