PHPackages                             tolstoydotcom/csvobject - 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. tolstoydotcom/csvobject

ActiveLibrary

tolstoydotcom/csvobject
=======================

Generates PHP classes to read a CSV file.

01PHP

Since Feb 23Pushed 6y ago1 watchersCompare

[ Source](https://github.com/TolstoyDotCom/csvobject)[ Packagist](https://packagist.org/packages/tolstoydotcom/csvobject)[ RSS](/packages/tolstoydotcom-csvobject/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

An easy way to read unfamiliar CSV files. Generates classes representing the CSV file and the rows. Requires PHP 7.2 or greater and Composer.

For instance, if a CSV has headers 'Make' and 'Model', the generated class representing the rows will have 'getMake' and 'getModel' methods.

Usage
-----

[](#usage)

- Install Composer if necessary.
- Create a new directory, open a command line window in that directory, and type:

```
git clone https://github.com/TolstoyDotCom/csvobject.git
cd csvobject
```

- (Alternatively, download this project into a local directory)
- (To use this in your own project: `composer require tolstoydotcom/csvobject`)
- In the root directory of this project, type:

```
composer update
```

- If the PHP extension mbstring isn't installed, either install it or type:

```
composer require symfony/polyfill-mbstring
```

- Make the `output` directory writable.
- Run this:

```
php generate.php -i data/test.csv -n MyTest -o output
```

That command takes `data/test.csv` as input, writes files tp `output`, and uses `MyTest` as the base name for the generated files.

Then, run this to see a demo of the `MyTestRow` methods:

```
php output/RunnerMyTest.php
```

Running generate.php produces three files in the output directory:

- MyTest.php: has the MyTest class that represents the CSV file, has methods to read each row, read all rows, etc.
- MyTestRow.php: has the MyTestRow class that represents the CSV.
- RunnerMyTest.php: uses MyTest to show the first few rows of the CSV.

Limitations
-----------

[](#limitations)

- This is just a simple library meant for local use and only with trusted CSVs. No attempt has been made to sanitize output, etc. If you install this on a public server, securing the installation is up to you.
- It assumes the headers are in the first row.
- Name collisions are possible.
- You might need to change the paths in the files if you move them around.
- Writing to the CSV isn't supported.

Licensing
---------

[](#licensing)

The source code is licensed under the The Apache Software License, Version 2.0, see LICENSE. The application includes many components from others and those are covered under their licenses.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/4f4b8d151f10af2838d00adc30a2cd8c0aa900ae8be89741da1b278d951d4aae?d=identicon)[TolstoyDotCom](/maintainers/TolstoyDotCom)

---

Top Contributors

[![TolstoyDotCom](https://avatars.githubusercontent.com/u/12502611?v=4)](https://github.com/TolstoyDotCom "TolstoyDotCom (2 commits)")

### Embed Badge

![Health badge](/badges/tolstoydotcom-csvobject/health.svg)

```
[![Health](https://phpackages.com/badges/tolstoydotcom-csvobject/health.svg)](https://phpackages.com/packages/tolstoydotcom-csvobject)
```

PHPackages © 2026

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