PHPackages                             loconox/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. [Framework](/categories/framework)
4. /
5. loconox/entity-routing-bundle

ActiveSymfony-bundle[Framework](/categories/framework)

loconox/entity-routing-bundle
=============================

Symfony EntityRoutingBundle

6.2.1(3y ago)014MITPHPPHP &gt;=8.1

Since Oct 30Pushed 3y ago1 watchersCompare

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

READMEChangelogDependencies (6)Versions (8)Used By (0)

LoconoxEntityRoutingBundle
==========================

[](#loconoxentityroutingbundle)

[![PHPUnit tests](https://github.com/loconox/EntityRoutingBundle/actions/workflows/php.yml/badge.svg)](https://github.com/loconox/EntityRoutingBundle/actions/workflows/php.yml/badge.svg)

Topos
-----

[](#topos)

### Problem

[](#problem)

Lets say that you want these routes in your application:

```
product-page:
    path: /{category}/{product}

user-page:
    path: /{group}/{user}
```

The Symfony router will build regex based on your route and try to match incoming request with these regex.

But regex for two different pages maybe the same, `/car/tesla` will match `product-page` route but `/scientist/tesla` will also match `product-page` route.

### Solution

[](#solution)

This bundle allow you to map route parameters to entity slug. For instance, the router will request your database and will not found any `Category` with `scientist` as slug. So it will go to the `user-page` route and check if any `Group` with `scientist` as slug exists.

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

[](#installation)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require loconox/entity-routing-bundle
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
