{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/13575","labels_url":"https://api.github.com/repos/symfony/symfony/issues/13575/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/13575/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/13575/events","html_url":"https://github.com/symfony/symfony/issues/13575","id":56320090,"number":13575,"title":"[Routing] Load routes via Puli","user":{"login":"Tobion","id":610090,"avatar_url":"https://avatars.githubusercontent.com/u/610090?v=3","gravatar_id":"","url":"https://api.github.com/users/Tobion","html_url":"https://github.com/Tobion","followers_url":"https://api.github.com/users/Tobion/followers","following_url":"https://api.github.com/users/Tobion/following{/other_user}","gists_url":"https://api.github.com/users/Tobion/gists{/gist_id}","starred_url":"https://api.github.com/users/Tobion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tobion/subscriptions","organizations_url":"https://api.github.com/users/Tobion/orgs","repos_url":"https://api.github.com/users/Tobion/repos","events_url":"https://api.github.com/users/Tobion/events{/privacy}","received_events_url":"https://api.github.com/users/Tobion/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/symfony/symfony/labels/Routing","name":"Routing","color":"DDDDDD"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-03T01:21:25Z","updated_at":"2015-02-08T15:29:29Z","closed_at":null,"body":"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.\r\n\r\nAdvantages:\r\n- 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\r\n- enabling/disabling routes via puli (which currently means importing or not importing the routing files)\r\n- overwriting routes via puli map\r\n- metadata for freshness check\r\n\r\nUnfortunately, 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.\r\n\r\nSymfony 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).\r\n\r\nUsers 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\"`.\r\nThe 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.\r\n\r\n@webmozart what do you think?"},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/73415553","html_url":"https://github.com/symfony/symfony/issues/13575#issuecomment-73415553","issue_url":"https://api.github.com/repos/symfony/symfony/issues/13575","id":73415553,"user":{"login":"sstok","id":904790,"avatar_url":"https://avatars.githubusercontent.com/u/904790?v=3","gravatar_id":"","url":"https://api.github.com/users/sstok","html_url":"https://github.com/sstok","followers_url":"https://api.github.com/users/sstok/followers","following_url":"https://api.github.com/users/sstok/following{/other_user}","gists_url":"https://api.github.com/users/sstok/gists{/gist_id}","starred_url":"https://api.github.com/users/sstok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sstok/subscriptions","organizations_url":"https://api.github.com/users/sstok/orgs","repos_url":"https://api.github.com/users/sstok/repos","events_url":"https://api.github.com/users/sstok/events{/privacy}","received_events_url":"https://api.github.com/users/sstok/received_events","type":"User","site_admin":false},"created_at":"2015-02-08T15:29:29Z","updated_at":"2015-02-08T15:29:29Z","body":"Using Puli as resource-type will be the most flexible I think.\r\n\r\nI actually thought about some similar a while back.\r\nhttps://gist.github.com/sstok/a965a4bf0b6162e07273 "}}