Generating CSV files or importing data from them should not be difficult. Luckily, there are loads of packages out there that do this very thing, but some of there are verbose, some of them just don't work.
FastCSV tries to improve this experience with a fluent API, heavily inspired by Spatie's Simple Excel, but targeted just as CSV files. FastCSV also works with PHP >=7.2, whereas Spatie's Simple Excel only works with PHP >=7.4.
You can install the package via composer:
composer require ryangjchandler/fastcsv
<?php use Ryangjchandler\FastCSV\FastCSV; FastCSV::write('./path/to/file.csv') ->addRow(['test' => 'cool', 'amazing' => 'row']) ->addRow(['test' => 'another', 'amazing' => 'row']);
This will create a file at the specified path, with the following value:
test,amazing cool,row another,row
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email firstname.lastname@example.org instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
PHP Package Boilerplate
This package was generated using the PHP Package Boilerplate.