PHPackages                             chrismou/php-eol-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. chrismou/php-eol-csv

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

chrismou/php-eol-csv
====================

A class for creating CSV files, allowing you to set a custom end-of-line character

v1.0.0(10y ago)21101MITPHP

Since Nov 19Pushed 3y ago1 watchersCompare

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

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

Archived
--------

[](#archived)

When I wrote this it did exactly what I needed it to do, but with the number of great 3rd party packages available now it's not really needed anymore. If you want full control of your CSVs, check out the excellent [phpleague/csv](https://csv.thephpleague.com/)

PHP Custom end-of-line CSV class
================================

[](#php-custom-end-of-line-csv-class)

[![Travis Build Status](https://camo.githubusercontent.com/ba1490f257a9ea241420b00aa934381fae00c73087152ff093bb5ca7e4ace1de/68747470733a2f2f7472617669732d63692e6f72672f63687269736d6f752f7068702d656f6c2d6373762e737667)](https://travis-ci.org/chrismou/php-eol-csv)[![Test Coverage](https://camo.githubusercontent.com/f94910cd2d253c6b636ee4cefc5aca61e3f8a743f255cfdb92b9a40e9cdd47e4/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f63687269736d6f752f7068702d656f6c2d6373762f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/chrismou/php-eol-csv/coverage)[![Code Climate](https://camo.githubusercontent.com/3fcc8eb532a2738288e6b43c9af83866f8ab3032d98d040caf379751ca099f5d/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f63687269736d6f752f7068702d656f6c2d6373762f6261646765732f6770612e737667)](https://codeclimate.com/github/chrismou/php-eol-csv)[![Buy me a beer](https://camo.githubusercontent.com/84435278ebf644da9ba4ece64a76602c16bb88edd474ee54cc757a17eca9666f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d50617950616c2d3031394344452e737667)](https://www.paypal.me/chrismou)

About
-----

[](#about)

This class provides the flexibility of creating CSV files in PHP with a custom end-of-line character.

PHP's `fputcsv` function allows you to specify a field delimiter, but strangely doesn't let you set the EOL character - which, when it insists on `\n`, isn't always helpful when the files are destined for people to view/edit on a Windows based systems.

Install
-------

[](#install)

To install via [Composer](http://getcomposer.org/):

```
composer require chrismou/php-eol-csv

```

Usage
-----

[](#usage)

Instantiate the class:

```
$csv = new \Chrismou\PhpEolCsv\Csv;

```

Open a CSV file for editing:

```
$csv->open($fileName, $savePath, $eol, $fileExtension, $delimiter, $enclosure);

```

- **$fileName** (required) - the filename to use. Don't include the file extension, this can be set seperately.
- **$savePath** - The path to save the file. Leaving this blank will save directly to the output buffer for a direct download.
- **$eol** - The EOL character/string to use. Defaults to `\n`.
- **$fileExtension** - The file extension to use. Defaults to `csv`.
- **$delimiter** - The character/string to use as a separator between fields. Defaults to `,`.
- **enclosure** - The character to use to enclose multi-word strings, or strings that include the delimiter character. Defaults to `"`.

Write a row to the CSV:

```
$csv->write(array("Field1", "Field2", "Field3"));

```

Finish editing and close the file:

```
$csv->close();

```

Supported versions
------------------

[](#supported-versions)

PHP 5.3 upwards, including HHVM.

Tests
-----

[](#tests)

To run the unit test suite:

```
curl -s https://getcomposer.org/installer | php
php composer.phar install
./vendor/bin/phpunit

```

A [DUnit](https://github.com/Vectorface/dunit) config file is also included, allowing you to easily run tests on all supported PHP versions.

First, you need to have docker installed. This is fairly simple on Linux - on OSX and Windows, take a look at [docker machine](https://docs.docker.com/machine/).

Assuming you have composer setup (see above), run the tests with the following command:

```
./vendor/bin/dunit

```

License
-------

[](#license)

Released under the MIT License. See [LICENSE.md](LICENSE.md).

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 96.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3824d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/98e0798db43673fb89fe589cbb45fb4c6547d3bdbe76d7efa30d96f24ffc677e?d=identicon)[chrismou](/maintainers/chrismou)

---

Top Contributors

[![chrismou](https://avatars.githubusercontent.com/u/319883?v=4)](https://github.com/chrismou "chrismou (29 commits)")[![matthewfedak](https://avatars.githubusercontent.com/u/425340?v=4)](https://github.com/matthewfedak "matthewfedak (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/chrismou-php-eol-csv/health.svg)

```
[![Health](https://phpackages.com/badges/chrismou-php-eol-csv/health.svg)](https://phpackages.com/packages/chrismou-php-eol-csv)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
