Routing
Routing copied to clipboard
split into symfony-cmf/chain-router and symfony-cmf/dynamic-router
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:
- should we keep the namespace the same? that would mean that there is a risk that if we accidentally add a class with the same FQN in both repositories, one would hide the other. if we change the namespace, it will be a bit more annoying to upgrade for consumers.
- should the routing bundle depend on both components? or do we also split the bundle? i tend to have the bundle depend on both.
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?
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).
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 🤷
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.