Skip to content

Silverkron/php-csv-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP csv builder

GitHub last commit Latest Stable Version Jarvis approved GitHub license Twitter

Build csv file and save or download it. Simple librery to write csv file in your php application

Install

Install php-csv-builder with Composer.

$ composer require silverkron/php-csv-builder

Initialize the class

use CsvBuilder\CsvBuilder;

$csvBuilder = new CsvBuilder();

Available methods

Change default destination path

setFilePath(<string>)

$csvBuilder->setFilePath('/path/to/file');

Change default file name

setFileName(<string>)

$csvBuilder->setFileName('/path/to/file');

Set row of titles (required)

setTitles(<array>)

$csvBuilder->setTitles([
   'Title 1',
   'Title 2',
   'Title 3',
   'Title 4'
]);

Clear all rows

clearRows(<array>)

$csvBuilder->clearRows();

Add new row (required)

addRow(<array>)

$csvBuilder->addRow([
    'Column 1',
    'Column 2',
    'Column 3',
    'Column 4',
]);

Build the csv file (required for download)

create()

$csvBuilder->create();

Download csv file

download()

$csvBuilder->download();

License

The MIT License (MIT). Please see LICENSE for more information.

About

Build csv file and save or download it. Simple librery to write csv file in your php application

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages