monokakure / laravel-csv
Simple CSV manipulation for Laravel. Also you can select encoding.
Installs: 33 725
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 3
Open Issues: 1
Requires
- php: >=5.3.0
- illuminate/support: >=4.1.0
Requires (Dev)
- phpunit/phpunit: 3.7.*
- way/phpunit-wrappers: dev-master
This package is not auto-updated.
Last update: 2024-11-13 07:48:59 UTC
README
Simple CSV manipulation for Laravel. Also you can select encoding.
Getting started
Add to composer.json
'monokakure/laravel-csv': 'dev-master'
Install your composer
composer install
Add ServiceProvider to app.php
'Monokakure\CSV\CSVServiceProvider',
If you want, add Alias
'CSV'=> 'Monokakure\CSV\CSVFacade',
Usage
- from array
CSV::create($arr, $header);
- get CSV
CSV::create($arr, $header)->build();
- You can select Encode
CSV::setEncode('SJIS-win', 'UTF-8')->create($arr, $header)->build();
- You can put BOM
CSV::create($arr, $header)->setBOM_UTF8()->build(); CSV::create($arr, $header)->setBOM_UTF16LE()->build();
- You can change delimiter
CSV::create($arr, $header)->setDelimiter("\t")->build();
- get Response
CSV::create($arr, $header)->render();
- parse CSV
CSV::parse('sample.csv');
Extend
If you want, you can use extended Monokakure\CSV\CSV class. Override Monokakure\CSV\Factory#getCSV method.