PHPackages                             jamesgordo/php-csv-parser - 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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. jamesgordo/php-csv-parser

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

jamesgordo/php-csv-parser
=========================

Easiest and Convenient Way to Parse CSV Files using PHP.

1.0.6(1y ago)2926.8k↓23.1%8[1 PRs](https://github.com/jamesgordo/php-csv-parser/pulls)MITPHPPHP &gt;=5.3

Since Jun 6Pushed 1y ago4 watchersCompare

[ Source](https://github.com/jamesgordo/php-csv-parser)[ Packagist](https://packagist.org/packages/jamesgordo/php-csv-parser)[ RSS](/packages/jamesgordo-php-csv-parser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (1)Versions (8)Used By (0)

PHP CSV Parser
==============

[](#php-csv-parser)

[![Build Status](https://camo.githubusercontent.com/8d7b7f2f355bb0e6029f47a920ef423049dd43754ba61e5d1780689050f8a777/68747470733a2f2f7472617669732d63692e6f72672f6a616d6573676f72646f2f7068702d6373762d7061727365722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jamesgordo/php-csv-parser) [![codecov](https://camo.githubusercontent.com/13cda0209652ab94e898ab9bbc5a86a72c853c43346a2d1be3f132790b6c79ae/68747470733a2f2f636f6465636f762e696f2f67682f6a616d6573676f72646f2f7068702d6373762d7061727365722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/jamesgordo/php-csv-parser) [![stability-stable](https://camo.githubusercontent.com/1a956613eeacedff433002d943b21af7782c547c24933d5647943c553beaada5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73746162696c6974792d737461626c652d677265656e2e737667)](https://github.com/jamesgordo/php-csv-parser)

Turn your CSV files into readable and accessable Data Objects easily. This Library wraps the PHP's built-in `fgetcsv` function to provide you a hassle free CSV File parsing.

Each row on your CSV file is dynamically transformed into Data Objects with keys set directly from the first row of your CSV file.

PHP Version Support
-------------------

[](#php-version-support)

The library has been tested to work on PHP Versions &gt;=5.3.

How to Use
----------

[](#how-to-use)

Run the following command in your terminal

```
composer require jamesgordo/php-csv-parser

```

Or simply add this to your `composer.json`

```
{
  "require": {
    "jamesgordo/php-csv-parser": "1.0.0"
  }
}
```

Then run

```
composer update

```

Create a Sample CSV File `users.csv`

```
id,first_name,last_name
1,John,Doe
2,Eric,Smith
3,Mark,Cooper
```

Example Implementation

```
