PHPackages                             dq042000/doctrine2-exporter - 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. dq042000/doctrine2-exporter

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

dq042000/doctrine2-exporter
===========================

MySQL Workbench Schema Exporter for Doctrine 2

v4.0.5(4mo ago)078MITPHPPHP &gt;=7.2CI failing

Since Nov 4Pushed 4mo agoCompare

[ Source](https://github.com/dq042000/doctrine2-exporter)[ Packagist](https://packagist.org/packages/dq042000/doctrine2-exporter)[ Docs](https://github.com/dq042000/doctrine2-exporter)[ RSS](/packages/dq042000-doctrine2-exporter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (20)Used By (0)

[![Build Status](https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/actions/workflows/continuous-integration.yml/badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/fb4bc2de9fe845785ec43d9146a6a194bf65f5854d847822b8ec271af863e475/68747470733a2f2f706f7365722e707567782e6f72672f6d7973716c2d776f726b62656e63682d736368656d612d6578706f727465722f646f637472696e65322d6578706f727465722f762f737461626c652e737667)](https://packagist.org/packages/mysql-workbench-schema-exporter/doctrine2-exporter)[![Total Downloads](https://camo.githubusercontent.com/a4b6f646f2eabf1720a9596a035ce59f1fabec09509641d3009706f8c3651a4b/68747470733a2f2f706f7365722e707567782e6f72672f6d7973716c2d776f726b62656e63682d736368656d612d6578706f727465722f646f637472696e65322d6578706f727465722f646f776e6c6f6164732e737667)](https://packagist.org/packages/mysql-workbench-schema-exporter/doctrine2-exporter)[![License](https://camo.githubusercontent.com/dd9c35b3040dc795da11b8e432948a5b2d6fab27ce84603aa1ac542f078f6550/68747470733a2f2f706f7365722e707567782e6f72672f6d7973716c2d776f726b62656e63682d736368656d612d6578706f727465722f646f637472696e65322d6578706f727465722f6c6963656e73652e737667)](https://packagist.org/packages/mysql-workbench-schema-exporter/doctrine2-exporter)

README
======

[](#readme)

This is an exporter to convert [MySQL Workbench](http://www.mysql.com/products/workbench/) Models (\*.mwb) to a Doctrine 2 Schema and upgraded to support Laminas.

[![image](https://user-images.githubusercontent.com/7939291/204090110-6ceef03b-efc1-4c13-906e-2dbc9a3dceec.png)](https://user-images.githubusercontent.com/7939291/204090110-6ceef03b-efc1-4c13-906e-2dbc9a3dceec.png)

[![image](https://user-images.githubusercontent.com/7939291/204090125-170d97f7-e7ae-4107-849c-b6c60645a562.png)](https://user-images.githubusercontent.com/7939291/204090125-170d97f7-e7ae-4107-849c-b6c60645a562.png)

[![image](https://user-images.githubusercontent.com/7939291/204090273-7993a675-ee29-4e80-adfa-72ee0ff1c702.png)](https://user-images.githubusercontent.com/7939291/204090273-7993a675-ee29-4e80-adfa-72ee0ff1c702.png)

Prerequisites
-------------

[](#prerequisites)

- PHP 7.2+
- Composer to install the dependencies

Installation
------------

[](#installation)

```
composer require --dev mysql-workbench-schema-exporter/doctrine2-exporter

```

This will install the exporter and also require [mysql-workbench-schema-exporter](https://github.com/mysql-workbench-schema-exporter/mysql-workbench-schema-exporter).

You then can invoke the CLI script using `vendor/bin/mysql-workbench-schema-export`.

Configuration
-------------

[](#configuration)

- [Doctrine 2.0 YAML Schema](/docs/doctrine2-yaml.md)
- [Doctrine 2.0 Annotation](/docs/doctrine2-annotation.md)
- [Doctrine 2.0 Annotation with ZF2 Input Filter Classes](/docs/doctrine2-zf2inputfilterannotation.md)

Model Comment Behavior
----------------------

[](#model-comment-behavior)

- `{d:bundleNamespace}AcmeBundle{/d:bundleNamespace}` (applied to Table)

    Override `bundleNamespace` option.
- `{d:m2m}false{/d:m2m}` (applied to Table)

    MySQL Workbench Schema Exporter tries to automatically guess which tables are many-to-many mapping tables and will not generate entity classes for these tables.

    A table is considered a mapping table, if it contains exactly two foreign keys to different tables and those tables are not many-to-many mapping tables.

    Sometimes this guessing is incorrect for you. But you can add a hint in the comment of the table, to show that it is no mapping table. Just use `{d:m2m}false{/d:m2m}` anywhere in the comment of the table.
- `{d:unidirectional}true{/d:unidirectional}` (applied to ForeignKey)

    All foreign keys will result in a bidirectional relation by default. If you only want a unidirectional relation, add a flag to the comment of the foreign key.
- `{d:owningSide}true{/d:owningSide}` (applied to ForeignKey)

    In a bi-directional many-to-many mapping table the owning side of the relation is randomly selected. If you add this hint to one foreign key of the m2m-table, you can define the owning side for Doctrine.
- `{d:cascade}persist, merge, remove, detach, all{/d:cascade}` (applied to ForeignKey)

    You can specify Doctrine cascade options as a comment on a foreign key. They will be generated into the Annotation. ([Reference](http://doctrine-orm.readthedocs.org/en/latest/reference/working-with-associations.html#transitive-persistence-cascade-operations))
- `{d:fetch}EAGER{/d:fetch}` (applied to ForeignKey)

    You can specify the fetch type for relations in the comment of a foreign key. (EAGER or LAZY, doctrine default is LAZY)
- `{d:orphanRemoval}true{/d:orphanRemoval}` (applied to ForeignKey)

    Another option you can set in the comments of foreign key. ([Reference](http://doctrine-orm.readthedocs.org/en/latest/reference/working-with-associations.html#orphan-removal))
- `{d:order}column{/d:order}` (applied to ForeignKey)

    Apply OrderBy annotation to One To Many and Many To Many relation. OrderBy annotation can be written in the following format:

    ```
    column[,(asc|desc)]

    ```

    Multiple columns are supported, separated by line break. Example usage:

    ```
    {d:order}
      column1
      column1,desc
    {/d:order}

    ```
- `{d:cache}READ_ONLY, NONSTRICT_READ_WRITE, READ_WRITE{/d:cache}` (applied to Table and/or ForeignKey)

    You can specify Doctrine second level caching strategy as a comment on a table or foreign key. They will be generated into the Annotation or YAML. ([Reference](http://doctrine-orm.readthedocs.io/en/latest/reference/second-level-cache.html))
- `{d:relatedNames}RelationTable:NewName{/d:relatedNames}` (applied to Table)

    Overrides `relatedVarNameFormat`.

    Rename generated related column names when the table names and the `relatedVarNameFormat` pattern are not good enough. The format should be CamelCase singular and should map with the class name that is generated for the related entity. Can be written in the following format:

    ```
    RelationTableName:CustomRelationName

    ```

    Multiple relations are supported, separated by line break. Example usage: - on a "store\_products" table with "store\_product\_categories" and "store\_product\_images" related tables:

    ```
    {d:relatedNames}
    StoreProductCategory:Category
    StoreProductImage:Image
    {/d:relatedNames}

    ```

    It can be used in both parent / child tables. For example, on a "store\_product\_images" table:

    ```
    {d:relatedNames}
    StoreProduct:Product
    {/d:relatedNames}

    ```

    The generated StoreProduct class will have "category" and "image" properties instead of "storeProductCategory" and "storeProductImage", while the "StoreProductImage" class will have a "product" property instead of "storeProduct".

Command Line Interface (CLI)
----------------------------

[](#command-line-interface-cli)

See documentation for [mysql-workbench-schema-exporter](https://github.com/mysql-workbench-schema-exporter/mysql-workbench-schema-exporter#command-line-interface-cli)

Links
-----

[](#links)

- [MySQL Workbench](http://wb.mysql.com/)
- [Doctrine Project](http://www.doctrine-project.org/)

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance75

Regular maintenance activity

Popularity9

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~64 days

Recently: every ~223 days

Total

19

Last Release

136d ago

Major Versions

v3.1.3.11 → v4.0.12023-04-27

PHP version history (2 changes)v3.1.3.1PHP &gt;=5.4.0

v4.0.1PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/87dae7c0cd300708765fa203a65dce69ba42aee46bfe4aba67fbd7f5f8c7f5de?d=identicon)[dq042000](/maintainers/dq042000)

---

Top Contributors

[![tohenk](https://avatars.githubusercontent.com/u/350747?v=4)](https://github.com/tohenk "tohenk (104 commits)")[![johmue](https://avatars.githubusercontent.com/u/281784?v=4)](https://github.com/johmue "johmue (66 commits)")[![dq042000](https://avatars.githubusercontent.com/u/7939291?v=4)](https://github.com/dq042000 "dq042000 (28 commits)")[![DamienHarper](https://avatars.githubusercontent.com/u/2448660?v=4)](https://github.com/DamienHarper "DamienHarper (17 commits)")[![rvock](https://avatars.githubusercontent.com/u/209159?v=4)](https://github.com/rvock "rvock (17 commits)")[![adrianbardan](https://avatars.githubusercontent.com/u/2693350?v=4)](https://github.com/adrianbardan "adrianbardan (6 commits)")[![doncem](https://avatars.githubusercontent.com/u/1420191?v=4)](https://github.com/doncem "doncem (5 commits)")[![defyasdf](https://avatars.githubusercontent.com/u/1632536?v=4)](https://github.com/defyasdf "defyasdf (5 commits)")[![Yoda-BZH](https://avatars.githubusercontent.com/u/751889?v=4)](https://github.com/Yoda-BZH "Yoda-BZH (3 commits)")[![s2x](https://avatars.githubusercontent.com/u/196585?v=4)](https://github.com/s2x "s2x (2 commits)")[![meven](https://avatars.githubusercontent.com/u/620941?v=4)](https://github.com/meven "meven (2 commits)")[![HobieCat](https://avatars.githubusercontent.com/u/4680160?v=4)](https://github.com/HobieCat "HobieCat (1 commits)")[![leocavalcante](https://avatars.githubusercontent.com/u/183722?v=4)](https://github.com/leocavalcante "leocavalcante (1 commits)")[![allansun](https://avatars.githubusercontent.com/u/20531?v=4)](https://github.com/allansun "allansun (1 commits)")[![verticka](https://avatars.githubusercontent.com/u/391828?v=4)](https://github.com/verticka "verticka (1 commits)")[![drymek](https://avatars.githubusercontent.com/u/492240?v=4)](https://github.com/drymek "drymek (1 commits)")

---

Tags

clidatabasemysqldoctrinemysql workbench

### Embed Badge

![Health badge](/badges/dq042000-doctrine2-exporter/health.svg)

```
[![Health](https://phpackages.com/badges/dq042000-doctrine2-exporter/health.svg)](https://phpackages.com/packages/dq042000-doctrine2-exporter)
```

###  Alternatives

[mysql-workbench-schema-exporter/mysql-workbench-schema-exporter

MySQL Workbench Schema Exporter

488188.5k10](/packages/mysql-workbench-schema-exporter-mysql-workbench-schema-exporter)[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58523.9M36](/packages/scienta-doctrine-json-functions)[mysql-workbench-schema-exporter/doctrine2-exporter

MySQL Workbench Schema Exporter for Doctrine 2

25143.3k2](/packages/mysql-workbench-schema-exporter-doctrine2-exporter)

PHPackages © 2026

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