symfony-cmf / Routing

Routing component building on the Symfony Routing component
Other
289 stars 70 forks source link

split into symfony-cmf/chain-router and symfony-cmf/dynamic-router #274

Open dbu opened 2 years ago

dbu commented 2 years ago

splitting this into 2 repositories would make the purpose of each repository clearer. the chain router is only a few classes, and shares no code with the dynamic router. this would be a clear benefit for users only wanting the chain router. (most people using the dynamic router probably also want to use chain router to be able to still use configured routing in addition to dynamic)

questions:

danrot commented 2 years ago

Just wondering: What's the use case for having a chain router without a dynamic router? Are there other router implementations I am not aware of? Or do you want to support creating a completely different individual router per project? And is that something people already do?

dbu commented 2 years ago

i expect some people to have implemented https://github.com/symfony/symfony/blob/6.1/src/Symfony/Component/Routing/RouterInterface.php with their own custom logic. e.g. to bridge into a legacy application, or for a much simpler thing than dynamic router.

technically, the 2 parts in this repository have no direct dependency in either direction. the chain router is generic, and the dynamic router would work just fine without the chain router (probably rather in a non symfony-full-stack context).

aschempp commented 2 years ago

i expect some people to have implemented https://github.com/symfony/symfony/blob/6.1/src/Symfony/Component/Routing/RouterInterface.php with their own custom logic. e.g. to bridge into a legacy application, or for a much simpler thing than dynamic router.

If that legacy application already has a router and multiple controllers, maybe that would be the case. Not sure if that would be applicable e.g. for someone migrating from a Silex app.

In the case of Contao CMS, we used a simple catch all route (with our custom router loader) in the regular Symfony router when we moved to Symfony initially. It provided all we needed, it just always forwarded to the same controller which then did run the legacy router. We then started actually using the DynamicRouter because it was exactly what we needed: to load dynamic router from database into the routing system. I would never have thought about using the ChainRouter separately 🤷

dbu commented 2 years ago

there is at least one application using only the chain router: https://twitter.com/SnakeAAS/status/1526843448644489216

even if most people will install both, i think we would benefit from the added clarity of splitting the repository.