golpilolz / csv-om
Object manager for CSV files
v0.0.8
2026-11-03 09:06 UTC
Requires
- php: >=8.3
- league/csv: ^9.28
- psr/container: ^1.1 | ^2.0
- symfony/config: ^7.4 | ^8
- symfony/dependency-injection: ^7.4 | ^8
- symfony/http-kernel: ^7.4 | ^8
- symfony/yaml: ^7.4 | ^8
Requires (Dev)
- phpunit/phpunit: ^11.5
- rector/rector: ^2.8
- symfony/maker-bundle: ^1.60
- symfony/string: ^7.4 | ^8
Suggests
- symfony/maker-bundle: Enables the make:csv-entity command
Provides
None
Conflicts
None
Replaces
None
README
A Doctrine-style object manager for Symfony, backed by CSV files: one file is one table, one row is one
object. You map classes with attributes, then use find(), repositories, persist() and flush() as you
would with Doctrine ORM.
$book = $om->find(Book::class, 7); $book->setTitle('Foundation and Empire'); $om->persist(new Book(8, 'Second Foundation')); $om->flush(); // rewrites library/books.csv
Requires PHP 8.3+, Symfony 7.4 or 8.x (Symfony 8 needs PHP 8.4+) and league/csv 9.28+.
Installation
The package is not on Packagist. Add the repository, then require it:
{
"repositories": [
{ "type": "vcs", "url": "git@github.com:golpilolz/csv-om.git" }
]
}
composer require golpilolz/csv-om:dev-main
A draft Flex recipe is in recipe/ (not published yet, so it is not applied automatically). Register the bundle in config/bundles.php:
return [ // ... Golpilolz\CsvOm\GolpilolzCsvOmBundle::class => ['all' => true], ];
Documentation
- Configuration: directory, delimiter, enclosure.
- Mapping:
#[Entity](a file or a directory of files),#[Id],#[Column]and supported types. - Usage: reading, writing and custom repositories.
- Associations:
ManyToOne,OneToMany,OneToOne,ManyToMany. - Lifecycle events: entity callbacks and listeners (
prePersist,postLoad, ...). - File format and errors: CSV rules and exception reference.
- Limitations and deprecations.
- Development: tests, Rector,
make:csv-entity. - Cookbook: worked examples, testing, troubleshooting.
- Architecture: code map and invariants, for contributors.