PHP CSV Export Download: Export array data to a CVS file to be downloaded

Recommend this page to a friend!
  Info   View files Documentation   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2020-09-21 (3 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 4 This week: 4All time: 10,076 This week: 65Up
Version License PHP version Categories
php-csv-export 1.0Custom (specified...5PHP 5, Files and Folders
Description Author

This package can export array data to a CVS file to be downloaded.

It can take an array of data to be exported and generates a CSV file that is served for download as a file with a given name.

The CSV file name and the CSV column header names are configurable parameters.

Picture of Hashemi Rafsan
  Performance   Level  
Name: Hashemi Rafsan <contact>
Classes: 3 packages by
Country: Bangladesh Bangladesh

Details

PHP CSV Export

A simple & lightweight csv export package for PHP

Installation

You can start it from composer. Go to your terminal and run this command from your project root directory.

composer require hashemi/php-csv-export

Usage

After Complete installation, It's time to check how to use.

<?php

require_once __DIR__ . '/vendor/autoload.php';

use Hashemi\CsvExport\CsvExport;

$headers = [
    'id',
    'name',
    'age'
];

$rows = [
    [1, 'Foo', 12],
    [2, 'Bar', 34],
    [3, 'John', 12]
];

(new CsvExport())
    ->setHeaders($headers)
    ->setRows($rows)
    ->setFileName('employee.csv')
    ->download();

// or

(new CsvExport($headers, $rows, 'employee.csv'))->download();

Contributing

Pull requests are welcome. For any changes, please open an issue first to discuss what you would like to change.

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Read me

  Files folder image Files  /  src  
File Role Description
  Plain text file CsvExport.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:4
This week:4
All time:10,076
This week:65Up

For more information send a message to info at phpclasses dot org.