# Dynamic routing (again)

**URL:** <https://discourse.cakephp.org/t/dynamic-routing-again/9705>\
**Category:** Need Help\
**Created:** [September 12, 2021, 7:55am UTC](https://discourse.cakephp.org/t/dynamic-routing-again/9705 "2021-09-12T07:55:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![6120](https://avatars.discourse-cdn.com/v4/letter/6/278dde/32.png) [@6120](https://discourse.cakephp.org/u/6120)\
**Post date:** [September 12, 2021, 7:55am UTC](https://discourse.cakephp.org/t/dynamic-routing-again/9705/1 "2021-09-12T07:55:26Z")

</div>

CakePHP 3.x and 4.x  
Is there a way to write dynamic routes in DB ?

Example :  
I tried to fill a url field with : [‘controller’ =\> ‘Articles’, ‘action’ =\> ‘view’, 2]  
and then I wrote Router::url($item-\>url)  
(this route is also defined in routes.php)

Best would be to be able to write a full route like :  
(’/la-librairie’, [‘controller’ =\> ‘articles’, ‘action’ =\> ‘index’, 2])  
and then : $routes-\>connect($item-\>url)  
I tried several combinations but none did work.

The aim is to be able to write dynamic urls easily.

Any idea ?

---

<div class="post-metadata">

**Author:** ![KevinPfeifer](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kevinpfeifer/32/3365_2.png) [@KevinPfeifer](https://discourse.cakephp.org/u/KevinPfeifer)\
**Post date:** [September 12, 2021, 8:20pm UTC](https://discourse.cakephp.org/t/dynamic-routing-again/9705/2 "2021-09-12T20:20:12Z")

</div>

I guess you can find some usefull toos in [GitHub - dereuromark/cakephp-tools: A CakePHP Tools plugin containing lots of useful helpers, behaviors, components, shells, ...](https://github.com/dereuromark/cakephp-tools)

---

<div class="post-metadata">

**Author:** ![6120](https://avatars.discourse-cdn.com/v4/letter/6/278dde/32.png) [@6120](https://discourse.cakephp.org/u/6120)\
**Post date:** [September 13, 2021, 1:20am UTC](https://discourse.cakephp.org/t/dynamic-routing-again/9705/3 "2021-09-13T01:20:18Z")

</div>

Thank you.  
I’ll have a look at this.
