This package is abandoned and no longer maintained. The author suggests using the traderinteractive/column-parser package instead.

A library that parses columnar data from a string, e.g. from CLI output.

v2.0.0 2018-03-05 17:56 UTC


Build Status Scrutinizer Code Quality Coverage Status

Latest Stable Version Latest Unstable Version License

Total Downloads Daily Downloads Monthly Downloads

A PHP library that parses columnar data from a string, e.g. from CLI output.


This library requires PHP 7.0, or newer.


This package uses composer so you can just add traderinteractive/column-parser as a dependency to your composer.json file.

composer require traderinteractive/column-parser

Formats Supported

This library parses input that has to conform to a supported format.

Multispaced Headers

This parses a string where there are at least two spaces between the columns. The first line in the string is the headers. Each header is expected to be separated by at least two spaces. A single space is treated as interior space of the header (i.e. multiple-word headers).


For example, given the following $contents:

Name     Age  City of Birth
James    17   San Francisco, CA
Mary     18   Washington, D.C.
William  22   Dallas, TX

and the following code:

$parser = new MultispacedHeadersParser($contents);
$data = $parser->getRows();

would result in $data containing:

        'Name' => 'James',
        'Age' => '17',
        'City of Birth' => 'San Francisco, CA',
        'Name' => 'Mary',
        'Age' => '18',
        'City of Birth' => 'Washington, D.C.',
        'Name' => 'William',
        'Age' => '22',
        'City of Birth' => 'Dallas, TX',


If you would like to contribute, please use our build process for any changes and after the build passes, send us a pull request on github!


There is also a docker-based fig configuration that will execute the build inside a docker container. This is an easy way to build the application:

fig run build