1. Go to this page and download the library: Download doskyft/csv-helper 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/ */
doskyft / csv-helper example snippets
use Doskyft\CsvHelper\ColumnDefinition;
use Doskyft\CsvHelper\Csv;
use Doskyft\CsvHelper\Types;
$csv = new Csv();
$csv
->setColumnSeparator(',')
->setColumns([
ColumnDefinition::new('a_string_columns', Types::STRING),
ColumnDefinition::new('a_bool_columns', Types::BOOLEAN)
->setConverterOptions([
'falseValues' => ['false', 'not true', '...'],
]),
])
->setAllColumnsIsNeeded(false)
->setTrim(false)
;
$results = $csv->readFromString('
a_string_columns,a_bool_columns
value,not true
value 2,true
');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.