PHP code example of silverkron / php-csv-builder

1. Go to this page and download the library: Download silverkron/php-csv-builder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

silverkron / php-csv-builder example snippets


use CsvBuilder\CsvBuilder;

$csvBuilder = new CsvBuilder();

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

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

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

$csvBuilder->clearRows();

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

$csvBuilder->create();

$csvBuilder->download();

$ composer