PHP Classes

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    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 130 This week: 1All time: 9,338 This week: 560Up
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: 7 packages by
Country: Bangladesh Bangladesh
Age: 28
All time rank: 382646 in Bangladesh Bangladesh
Week rank: 416 Up9 in Bangladesh Bangladesh Up
Innovation award
Innovation award
Nominee: 1x

Documentation

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:130
This week:1
All time:9,338
This week:560Up