PHPackages                             kzykhys/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kzykhys/php-csv-parser

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

kzykhys/php-csv-parser
======================

Convert CSV to array (Excel style is fully suppoted!)

1.4.1(12y ago)53277.7k—9.9%24[2 issues](https://github.com/kzykhys/PHPCsvParser/issues)[3 PRs](https://github.com/kzykhys/PHPCsvParser/pulls)4MITPHPPHP &gt;=5.3.3

Since Jan 31Pushed 3y ago5 watchersCompare

[ Source](https://github.com/kzykhys/PHPCsvParser)[ Packagist](https://packagist.org/packages/kzykhys/php-csv-parser)[ RSS](/packages/kzykhys-php-csv-parser/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)DependenciesVersions (10)Used By (4)

PHPCsvParser
============

[](#phpcsvparser)

Convert CSV to array/Iterator (Excel style is fully suppoted!)

[![Latest Stable Version](https://camo.githubusercontent.com/78bcf7cb885a139430ef5176556df3fa4cb3a75c5381f6b09242dc72bde308e1/68747470733a2f2f706f7365722e707567782e6f72672f6b7a796b6879732f7068702d6373762d7061727365722f762f737461626c652e706e67)](https://packagist.org/packages/kzykhys/php-csv-parser)[![Build Status](https://camo.githubusercontent.com/e86ef065e92a8dcd5b65005897b712abe71cbc238f64394ad2f3c163ab582793/68747470733a2f2f7472617669732d63692e6f72672f6b7a796b6879732f5048504373765061727365722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/kzykhys/PHPCsvParser)[![Coverage Status](https://camo.githubusercontent.com/c1b96b9f4657a9c39fb3a43561bb3d245383516e085b12762f7aa856b03feb23/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6b7a796b6879732f5048504373765061727365722f62616467652e706e67)](https://coveralls.io/r/kzykhys/PHPCsvParser)[![SensioLabsInsight](https://camo.githubusercontent.com/9d8538ac1653e3677cc4020d4b88300e5be15f86f1d7cb6128ec4f257de85340/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f36373138323037352d386531312d343132352d623963322d3666323965353732366333312f6d696e692e706e67)](https://insight.sensiolabs.com/projects/67182075-8e11-4125-b9c2-6f29e5726c31)

Why PHPCsvParser?
-----------------

[](#why-phpcsvparser)

As you know, PHP has built-in `fgetcsv` function. But has some probrems:

- Line breaks in the cell
- Multibyte string (especially NON UTF-8)
- Double quote in the cell

Requirements
------------

[](#requirements)

**PHP5.3.3 or later**

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

[](#installation)

Create or modify your composer.json

```
{
    "require": {
        "kzykhys/php-csv-parser": ">1.4"
    }
}
```

And run

```
$ php composer.phar install
```

Usage
-----

[](#usage)

### Parse a CSV file

[](#parse-a-csv-file)

```
1,"some text",150
2,"some multi line
text",2000

```

```
