league / csv
CSV data manipulation made easy in PHP
Fund package maintenance!
nyamsprod
Installs: 113 411 986
Dependents: 618
Suggesters: 73
Security: 0
Stars: 3 357
Watchers: 60
Forks: 338
Open Issues: 2
Requires
- php: ^8.1.2
- ext-filter: *
Requires (Dev)
- ext-dom: *
- ext-xdebug: *
- friendsofphp/php-cs-fixer: ^3.64.0
- phpbench/phpbench: ^1.3.1
- phpstan/phpstan: ^1.12.11
- phpstan/phpstan-deprecation-rules: ^1.2.1
- phpstan/phpstan-phpunit: ^1.4.1
- phpstan/phpstan-strict-rules: ^1.6.1
- phpunit/phpunit: ^10.5.16 || ^11.4.3
- symfony/var-dumper: ^6.4.8 || ^7.1.8
Suggests
- ext-dom: Required to use the XMLConverter and the HTMLConverter classes
- ext-iconv: Needed to ease transcoding CSV using iconv stream filters
- ext-mbstring: Needed to ease transcoding CSV using mb stream filters
- dev-master / 9.x-dev
- 9.20.1
- 9.20.0
- 9.19.0
- 9.18.0
- 9.17.0
- 9.16.0
- 9.15.0
- 9.14.0
- 9.13.0
- 9.12.0
- 9.11.0
- 9.10.0
- 9.9.0
- 9.8.0
- 9.7.4
- 9.7.3
- 9.7.2
- 9.7.1
- 9.7.0
- 9.6.2
- 9.6.1
- 9.6.0
- 9.5.0
- 9.4.1
- 9.4.0
- 9.3.0
- 9.2.1
- 9.2.0
- 9.1.4
- 9.1.3
- 9.1.2
- 9.1.1
- 9.1.0
- 9.0.1
- 9.0.0
- 8.2.3
- 8.2.2
- 8.2.1
- 8.2.0
- 8.1.2
- 8.1.1
- 8.1.0
- 8.0.0
- 7.2.0
- 7.1.2
- 7.1.1
- 7.1.0
- 7.0.1
- 7.0.0
- 6.3.0
- 6.2.0
- 6.1.0
- 6.0.1
- 6.0.0
- 5.4.0
- 5.3.1
- 5.3.0
- 5.2.0
- 5.1.0
- 5.0.0
- 4.2.1
- 4.2.0
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.0
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.1
- 3.0.0
- 2.0.0
- 1.0.0
This package is auto-updated.
Last update: 2024-12-18 21:07:57 UTC
README
Csv is a library to ease parsing, writing and filtering CSV in PHP. The library goal is to be powerful while remaining lightweight, by utilizing PHP native classes whenever possible.
Highlights
- Easy to use API
- Read and Write to CSV documents in a memory efficient and scalable way
- Support PHP stream filtering capabilities
- Transform CSV documents into popular format (JSON, XML or HTML)
- Fully documented
- Fully unit tested
- Framework-agnostic
Documentation
Full documentation can be found at csv.thephpleague.com.
System Requirements
You need the ext-filter
extension to use Csv
and the latest stable version of PHP is recommended.
Please find below the PHP support for Csv
version 9.
Install
Install Csv
using Composer.
composer require league/csv:^9.0
Configuration
Warning
Starting with PHP8.4 Deprecation notices will be trigger if you do not explicitly set the escape parameter. see Deprecation for PHP8.4 and CSV and PHP8.4
Tip
If your CSV document was created or is read on a Legacy Macintosh computer, add the following lines before using the library to help PHP detect line ending.
if (!ini_get('auto_detect_line_endings')) { ini_set('auto_detect_line_endings', '1'); }
Warning
The ini setting is deprecated since PHP version 8.1 and will be removed in PHP 9.0
Testing
The library has:
- a PHPUnit test suite.
- a coding style compliance test suite using PHP CS Fixer.
- a code analysis compliance test suite using PHPStan.
To run the tests, run the following command from the project folder.
composer test
Contributing
Contributions are welcome and will be fully credited. Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email nyamsprod@gmail.com instead of using the issue tracker.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see LICENSE for more information.