PHPackages                             tourze/doctrine-entity-routing-bundle - 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. [API Development](/categories/api)
4. /
5. tourze/doctrine-entity-routing-bundle

ActiveLibrary[API Development](/categories/api)

tourze/doctrine-entity-routing-bundle
=====================================

Symfony bundle for automatic Doctrine entity routing

0.1.0(6mo ago)00MITPHPCI passing

Since May 24Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/tourze/doctrine-entity-routing-bundle)[ Packagist](https://packagist.org/packages/tourze/doctrine-entity-routing-bundle)[ RSS](/packages/tourze-doctrine-entity-routing-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (22)Versions (3)Used By (0)

Doctrine Entity Routing Bundle
==============================

[](#doctrine-entity-routing-bundle)

[English](README.md) | [中文](README.zh-CN.md)

[![Latest Version](https://camo.githubusercontent.com/8583245852da8350b1e7c9e692c227fe6a3f063df338aec14f48f23acca30dc8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f646f637472696e652d656e746974792d726f7574696e672d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/doctrine-entity-routing-bundle)[![PHP Version Require](https://camo.githubusercontent.com/cd027ef445b103f60d9f883274dad658400a512f85c8db34ac0be8a6b27cf725/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f646f637472696e652d656e746974792d726f7574696e672d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/doctrine-entity-routing-bundle)[![License](https://camo.githubusercontent.com/30d1e765e639d49186b8ac1c2207ae24db961e1d09677dde11890618b197d5a0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f646f637472696e652d656e746974792d726f7574696e672d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/doctrine-entity-routing-bundle)[![Total Downloads](https://camo.githubusercontent.com/3623eb19956b14af8dd55323a1cc3bf296c80e3a3eb2d46fc08e4022811f0387/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f646f637472696e652d656e746974792d726f7574696e672d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/doctrine-entity-routing-bundle)[![Code Coverage](https://camo.githubusercontent.com/73d5a4ea59ebd4d3df8585c6987cae84660d543506035a0d6c8e88d5b2359e4d/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f746f75727a652f646f637472696e652d656e746974792d726f7574696e672d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/tourze/doctrine-entity-routing-bundle)

A Symfony Bundle that automatically generates REST API routes for Doctrine entity metadata inspection.

Features
--------

[](#features)

- Automatically discovers all Doctrine entities in your application
- Generates REST API endpoints for entity metadata inspection
- Provides JSON responses with table structure information
- Supports environment-based route generation control
- Includes comprehensive test coverage

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

[](#installation)

```
composer require tourze/doctrine-entity-routing-bundle
```

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

[](#configuration)

### Register the Bundle

[](#register-the-bundle)

Add the bundle to your `config/bundles.php`:

```
return [
    // ... other bundles
    Tourze\DoctrineEntityRoutingBundle\DoctrineEntityRoutingBundle::class => ['all' => true],
];
```

### Enable Route Generation

[](#enable-route-generation)

Set the environment variable to enable route generation:

```
# .env
ENTITY_METADATA_ROUTES=enabled
```

### Add Route Loader

[](#add-route-loader)

Add the route loader to your `config/routes.yaml`:

```
entity_routes:
    resource: .
    type: entity_route
```

Usage
-----

[](#usage)

Once configured, the bundle will automatically generate routes for all your Doctrine entities.

### API Endpoints

[](#api-endpoints)

For each entity table, the bundle generates:

```
GET /entity/desc/{table_name}

```

### Example Response

[](#example-response)

```
{
  "table": "user",
  "columns": [
    {
      "field": "id",
      "type": "integer",
      "length": null,
      "nullable": false
    },
    {
      "field": "email",
      "type": "string",
      "length": 255,
      "nullable": false
    },
    {
      "field": "name",
      "type": "string",
      "length": 100,
      "nullable": true
    }
  ]
}
```

### Error Response

[](#error-response)

If the table is not found:

```
{
  "error": "Table not found"
}
```

Requirements
------------

[](#requirements)

- PHP 8.1+
- Symfony 6.4+
- Doctrine ORM 3.0+
- Doctrine Bundle 2.13+

Dependencies
------------

[](#dependencies)

- `tourze/symfony-routing-auto-loader-bundle` - For automatic route loading
- Standard Symfony and Doctrine components

Testing
-------

[](#testing)

Run the test suite:

```
./vendor/bin/phpunit packages/doctrine-entity-routing-bundle/tests
```

Run PHPStan analysis:

```
php -d memory_limit=2G ./vendor/bin/phpstan analyse packages/doctrine-entity-routing-bundle
```

How It Works
------------

[](#how-it-works)

1. **Route Discovery**: The `AttributeControllerLoader` automatically discovers all Doctrine entities
2. **Route Generation**: For each entity table, it generates a REST endpoint
3. **Controller**: The `EntityMetadataController` handles requests and returns JSON metadata
4. **Environment Control**: Routes are only generated when `ENTITY_METADATA_ROUTES` is set

Architecture
------------

[](#architecture)

- **AttributeControllerLoader**: Implements `RoutingAutoLoaderInterface` to automatically generate routes
- **EntityMetadataController**: Handles API requests and returns JSON metadata
- **Integration**: Works with `tourze/symfony-routing-auto-loader-bundle` for seamless route loading

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project.

Changelog
---------

[](#changelog)

Please see [CHANGELOG.md](CHANGELOG.md) for details on what has changed recently.

License
-------

[](#license)

The MIT License (MIT). Please see [LICENSE](LICENSE) file for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance71

Regular maintenance activity

Popularity0

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

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

Total

2

Last Release

192d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e354fdb316da535dfa8ba2e9193a473c403b6bc6fb9170778d1dc50e304c6e9d?d=identicon)[tourze](/maintainers/tourze)

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-doctrine-entity-routing-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-doctrine-entity-routing-bundle/health.svg)](https://phpackages.com/packages/tourze-doctrine-entity-routing-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[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)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)

PHPackages © 2026

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