PHPackages                             middlewares/csv-payload - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. middlewares/csv-payload

ActiveLibrary[HTTP &amp; Networking](/categories/http)

middlewares/csv-payload
=======================

Middleware to parse the CSV body of the request

v1.0.0(1y ago)56[1 issues](https://github.com/middlewares/csv-payload/issues)MITPHPPHP ^7.2 || ^8.0CI passing

Since Mar 22Pushed 1y ago6 watchersCompare

[ Source](https://github.com/middlewares/csv-payload)[ Packagist](https://packagist.org/packages/middlewares/csv-payload)[ Docs](https://github.com/middlewares/csv-payload)[ RSS](/packages/middlewares-csv-payload/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (10)Versions (2)Used By (0)

middlewares/csv-payload
=======================

[](#middlewarescsv-payload)

[![Latest Version on Packagist](https://camo.githubusercontent.com/271629d9fbbe0e33eb61858dabbf1514bca20e44d46138934682d8119392a545/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6964646c6577617265732f6373762d7061796c6f61642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/middlewares/csv-payload)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Testing](https://github.com/middlewares/csv-payload/workflows/testing/badge.svg)](https://github.com/middlewares/csv-payload/workflows/testing/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/ce8f0f115e5d1ba5696107e1107b858c5917a70ef98e932ba6c3befccb18c01f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6964646c6577617265732f6373762d7061796c6f61642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/middlewares/csv-payload)

Extends [middlewares/payload](https://packagist.org/packages/middlewares/payload) to add support for parsing the CSV body of the request.

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

[](#requirements)

- PHP &gt;= 7.0
- A [PSR-7](https://packagist.org/providers/psr/http-message-implementation) http message implementation ([Diactoros](https://github.com/zendframework/zend-diactoros), [Guzzle](https://github.com/guzzle/psr7), [Slim](https://github.com/slimphp/Slim), etc...)
- A [PSR-15 middleware dispatcher](https://github.com/middlewares/awesome-psr15-middlewares#dispatcher)

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

[](#installation)

This package is installable and autoloadable via Composer as [middlewares/csv-payload](https://packagist.org/packages/middlewares/csv-payload).

```
composer require middlewares/csv-payload
```

CsvPayload
----------

[](#csvpayload)

Parses the CSV payload of the request. Uses [league/csv](https://packagist.org/packages/league/csv) to read the CSV values. Contains the following options to configure the CSV [`Reader`](http://csv.thephpleague.com/9.0/reader/) object:

#### `delimiter($delimiter)`

[](#delimiterdelimiter)

To configure the CSV delimiter control character (one character only). If the submitted character is invalid an `InvalidArgumentException` exception is thrown.

#### `enclosure($enclosure)`

[](#enclosureenclosure)

To configure the CSV enclosure control character (one character only). If the submitted character is invalid an `InvalidArgumentException` exception is thrown.

#### `escape($escape)`

[](#escapeescape)

To configure the CSV escape control character (one character only). If the submitted character is invalid an `InvalidArgumentException` exception is thrown.

#### `header($header)`

[](#headerheader)

To configure the CSV header line. If the submitted header value is less than 0 an `InvalidArgumentException` exception is thrown.

#### `methods(array $methods)`

[](#methodsarray-methods)

To configure the allowed methods. By default only the requests with the method `POST, PUT, PATCH, DELETE, COPY, LOCK, UNLOCK` are handled.

#### `contentType(array $contentType)`

[](#contenttypearray-contenttype)

To configure all Content-Type headers used in the request. By default is `text/csv`

#### `override($override = true)`

[](#overrideoverride--true)

To override the previous parsed body if exists (`false` by default)

```
$dispatcher = new Dispatcher([
    (new \Middlewares\CsvPayload())
        ->delimiter(";")
        ->enclosure("'")
        ->escape("\\")
]);

$response = $dispatcher->dispatch(new ServerRequest());
```

---

Please see [CHANGELOG](CHANGELOG.md) for more information about recent changes and [CONTRIBUTING](CONTRIBUTING.md) for contributing details.

The MIT License (MIT). Please see [LICENSE](LICENSE) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance42

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.9% 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

418d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/38203?v=4)[Woody Gilk](/maintainers/shadowhand)[@shadowhand](https://github.com/shadowhand)

![](https://www.gravatar.com/avatar/e99df56b617f4af8cf0556a51a0ca20c7420104920c57d7e9eab093f92bb744f?d=identicon)[oscarotero](/maintainers/oscarotero)

![](https://www.gravatar.com/avatar/42e0d72f42eb7d84f67e20d28606da42e5a3248ca908b1eadb4366aafeae2561?d=identicon)[filisko](/maintainers/filisko)

---

Top Contributors

[![oscarotero](https://avatars.githubusercontent.com/u/377873?v=4)](https://github.com/oscarotero "oscarotero (45 commits)")[![filisko](https://avatars.githubusercontent.com/u/8798694?v=4)](https://github.com/filisko "filisko (3 commits)")[![nyamsprod](https://avatars.githubusercontent.com/u/51073?v=4)](https://github.com/nyamsprod "nyamsprod (3 commits)")[![franzliedke](https://avatars.githubusercontent.com/u/249125?v=4)](https://github.com/franzliedke "franzliedke (1 commits)")[![shadowhand](https://avatars.githubusercontent.com/u/38203?v=4)](https://github.com/shadowhand "shadowhand (1 commits)")

---

Tags

csvhttpmiddlewarepayloadpsr-15httppsr-7middlewareservercsvpsr-15payload

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/middlewares-csv-payload/health.svg)

```
[![Health](https://phpackages.com/badges/middlewares-csv-payload/health.svg)](https://phpackages.com/packages/middlewares-csv-payload)
```

###  Alternatives

[middlewares/payload

Middleware to parse the body of the request with support for json, csv and url-encode

32466.8k17](/packages/middlewares-payload)[middlewares/request-handler

Middleware to execute request handlers

451.6M26](/packages/middlewares-request-handler)[middlewares/fast-route

Middleware to use FastRoute

96191.1k15](/packages/middlewares-fast-route)[middlewares/negotiation

Middleware to implement content negotiation

47442.1k11](/packages/middlewares-negotiation)[middlewares/http-authentication

Middleware to implement Basic and Digest Http authentication

35302.0k2](/packages/middlewares-http-authentication)[middlewares/whoops

Middleware to use Whoops as error handler

33205.4k24](/packages/middlewares-whoops)

PHPackages © 2026

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