Search by

rovangju / commie

rovangju

A simplistic OO wrapper around PHP's built in CSV handling that lets you reference columns by header name

Package info

github.com/rovangju/commie

pkg:composer/rovangju/commie

Statistics

Installs: 30

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-10-08 23:15 UTC

README

Tests

Introduction

Commie is a simplistic object-orientated wrapper around PHP's built in CSV handling.

The key difference with Commie is that it's the first library that will allow you to traverse the file's columns by name - as well as painlessly jump around the file in an efficient manner.

There's a few antique packages out in the wild that handle CSV files, however all of them seem to be lacking in one way or another, and don't lend themselves well to customization for the wild formats delimited data can come in. Commie implements a 'mapper' concept that allows you to do whatever strange things you need in addition to the core for traversal of your data.

Requirements

  • PHP 8.1 or later

Quick start

composer require rovangju/commie
<?php

require_once 'vendor/autoload.php';

use Commie\CSVFile;

$file = new SplFileObject('./file.csv');
$csv = new CSVFile($file, TRUE);

while (($row = $csv->read())) {
    echo $row->col('My Heading')->value();
}

echo $csv->row(10)->col('TOTAL')->value();

Contributing

Releases/versioning semantics follow the Semantic Versioning 2.0.x guidelines. Minute adjustments (e.g.: changes to this README.md) may or may not result in a new version tag, depending on the nature of the change.

Further details

You can examine the source, or run the test suite with:

composer test