-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
I think Puli (http://puli.io) can also be used for routes because they also have a name to reference them and they are meant to be shared across libraries.
Advantages:
- if Puli becomes the standard to reference resources in symfony, it would make things consistent to offer the same approach for routes and we can reuse puli functionality
- enabling/disabling routes via puli (which currently means importing or not importing the routing files)
- overwriting routes via puli map
- metadata for freshness check
Unfortunately, I think we cannot use the Puli mapping name as route name. As one resource only has one name, but we currently allow multiple routes be defined in one file, this cannot work. Otherwise we would need to change it to one route per file.
Symfony routing component would provide a binding type like symfony/routing
or special subtypes for the different formats (e.g. symfony/routing/annotation
when reading the route definitions from controller phpdocs).
Users would bind their routes to the type and the routing component would load them via the discovery mechanism. Currently when importing routes, people can customize things like the prefix
or #12141. I think in Puli it translates to http://docs.puli.io/en/latest/discovery.html#binding-parameters, e.g. puli bind /acme/blog/routes/*.yml symfony/routing/yml --param prefix="/blog"
. But the problem is that the end-user who enables the routes might want to overwrite some settings without overwriting the whole route resource. So I guess the user would disable the above binding provided by the blog bundle and instead make a custom binding like puli bind /acme/blog/routes/*.yml symfony/routing/yml --param prefix="/myprefix"
.
The whole import
feature within routing files would not be need anymore. And in theory one could get rid of the symfony/config dependency in the routing. But for the time beeing one would need a solution that works both with puli type binding and routing config loading.
@webmozart what do you think?