PHPackages                             leongersen/entity-generator - 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. [Database &amp; ORM](/categories/database)
4. /
5. leongersen/entity-generator

ActiveLibrary[Database &amp; ORM](/categories/database)

leongersen/entity-generator
===========================

Database-first Doctrine entity generator with oneToMany and manyToOne support

0.0.5(6y ago)5262[1 PRs](https://github.com/leongersen/entity-generator/pulls)MITPHPPHP ^7.1

Since Jan 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/leongersen/entity-generator)[ Packagist](https://packagist.org/packages/leongersen/entity-generator)[ RSS](/packages/leongersen-entity-generator/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (5)Dependencies (6)Versions (7)Used By (0)

Entity Generator
================

[](#entity-generator)

The Doctrine Project [will be removing support for generating entities](https://github.com/symfony/symfony-docs/issues/8893) in Doctrine 3.

Not all development workflows will fit the proposed entity-first database management strategy.

To keep supporting a database-first workflow this project implements an alternative database oriented entity generator.

Features
--------

[](#features)

- Generate entities with type annotations, getters, setters, adders and removers;
- Supports `oneToMany` and `manyToOne` relationships, including pluralization of properties and methods.

License
-------

[](#license)

This project is licensed [MIT](https://choosealicense.com/licenses/mit/) and can be used for free in any personal or commercial project.

Usage
-----

[](#usage)

```
bin/entity-generator entity-generator:generate
```

### Options

[](#options)

- `dsn` Accepts the same format as Doctrine, so the value configured in `.env` can be used
- `namespace` Namespace for the generated entities (Default `App\Entity`)
- `directory` Output directory for the generated entities (Default `src/Entity`)
- `collection-interface` Interface name for the collection type to use in the generated entities (Default `\Doctrine\Common\Collections\Collection`)
- `collection-implementation` (Default `\Doctrine\Common\Collections\ArrayCollection`)

### Using a DSN from a .env file

[](#using-a-dsn-from-a-env-file)

```
source .env
bin/entity-generator entity-generator:generate --dsn $DATABASE_URL
```

Implementation
--------------

[](#implementation)

- A mapping is generated from an existing database using `SHOW CREATE TABLE`.
- Entity classes are rendered using a Twig template.

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

[](#limitations)

- Only provides a `\PDO` based driver and an mapper for `MySQL`-like sql dialects.
- Annotations for (unique) indexes are not (yet) implemented
- `ManyToMany` relations are not (yet) supported ([motivation](https://stackoverflow.com/questions/18655286/doctrine-2-how-to-handle-join-tables-with-extra-columns))
- Doctrine Custom types are not supported

Open issues
-----------

[](#open-issues)

- Naming conflicts on `xyx_id` with a foreign key and field `xyx` (both become `xyz`)
- Naming conflicts on multiple foreign keys from one table to another (`xyz.abc_1_id` and `xyz.abc_2_id` both become `xyz.abcs`)
- Blobs are not yet implemented

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

2301d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2387777a7d7c7e3d19b630b1f28ba01656a1cbf4b3e3d0e6f18831042ed363bd?d=identicon)[leongersen](/maintainers/leongersen)

---

Top Contributors

[![leongersen](https://avatars.githubusercontent.com/u/1206361?v=4)](https://github.com/leongersen "leongersen (12 commits)")

---

Tags

doctrinedoctrine-ormentityphp7

### Embed Badge

![Health badge](/badges/leongersen-entity-generator/health.svg)

```
[![Health](https://phpackages.com/badges/leongersen-entity-generator/health.svg)](https://phpackages.com/packages/leongersen-entity-generator)
```

###  Alternatives

[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[ssch/typo3-rector

Instant fixes for your TYPO3 PHP code by using Rector.

2592.8M263](/packages/ssch-typo3-rector)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

134391.5k12](/packages/rector-rector-src)[guikingone/scheduler-bundle

A Symfony bundle that allows to schedule and create repetitive tasks

114217.4k](/packages/guikingone-scheduler-bundle)

PHPackages © 2026

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