PHPackages                             simpl/csv - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. simpl/csv

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

simpl/csv
=========

Makes reading CSV files Simpl!

v1.1.0(5y ago)070MITPHPPHP &gt;=5.6

Since Oct 14Pushed 5y ago1 watchersCompare

[ Source](https://github.com/simpl-php/csv)[ Packagist](https://packagist.org/packages/simpl/csv)[ Docs](https://github.com/simple-php/csv)[ RSS](/packages/simpl-csv/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

Simpl/Csv
=========

[](#simplcsv)

[![Build Status](https://camo.githubusercontent.com/edd4885b55b97c73b0f28b4466a9a16f3d79f0d764614c3e1c3b2afcb656104f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f73696d706c2d7068702f6373762e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/simpl-php/csv)

Reading delimited files... the Simpl way!
-----------------------------------------

[](#reading-delimited-files-the-simpl-way)

### Why should you use this? We already have `fgetcsv()`.

[](#why-should-you-use-this-we-already-have-fgetcsv)

Yes, `fgetcsv()` is great, and this package uses it under the hood - with some quality of life improvements.

The main benefits of this package are:

- Easy to set number of records to skip (like headings)
- You can give it an array of column headings and it will return the parsed row as an associative array.
    - This means you get to work with array keys you define instead of having to remember the numerical position.
- This provides some basic transformations out of the box.
    - Automatically trim all values.
    - Automatically convert empty strings to `null`.
- If you provide column headings, it will compare the number of column headings to the number of columns it parsed from each row and throw an exception if your data is missing a column.
- Return the full CSV as an array or json object.

Installation
------------

[](#installation)

```
composer require simpl/csv
```

Basic Usage
-----------

[](#basic-usage)

```
