2017 © Pedro Peláez
 

library csv-payload

Middleware to parse the CSV body of the request

image

middlewares/csv-payload

Middleware to parse the CSV body of the request

  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

middlewares/csv-payload

Latest Version on Packagist ![Software License][ico-license] Testing ![Total Downloads][ico-downloads], (*1)

Extends middlewares/payload to add support for parsing the CSV body of the request., (*2)

Requirements

Installation

This package is installable and autoloadable via Composer as middlewares/csv-payload., (*3)

composer require middlewares/csv-payload

CsvPayload

Parses the CSV payload of the request. Uses league/csv to read the CSV values. Contains the following options to configure the CSV Reader object:, (*4)

delimiter($delimiter)

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

enclosure($enclosure)

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

escape($escape)

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

header($header)

To configure the CSV header line. If the submitted header value is less than 0 an InvalidArgumentException exception is thrown., (*8)

methods(array $methods)

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

contentType(array $contentType)

To configure all Content-Type headers used in the request. By default is text/csv, (*10)

override($override = true)

To override the previous parsed body if exists (false by default), (*11)

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

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

Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details., (*12)

The MIT License (MIT). Please see LICENSE for more information., (*13)

The Versions