Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoloading of Routes From Bundles #22700

Closed
kiler129 opened this issue May 12, 2017 · 7 comments
Closed

Autoloading of Routes From Bundles #22700

kiler129 opened this issue May 12, 2017 · 7 comments

Comments

@kiler129
Copy link
Contributor

Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no

Dependency Injection Extensions are great way to let the bundle autoload their services and other configuration details. However routes needs to be included manually in main app routing file.

Is there any reason why extension or bundle cannot register routes? I know about advanced loaders, but isn't dynamically loading routes slow on production?

@xabbuh
Copy link
Member

xabbuh commented May 12, 2017

That's true for projects that are currently built on top of the Symfony Standard Edition. However, with Symfony Flex this will change and routes can be provided through recipes. That's why I am going to close here.

@xabbuh xabbuh closed this as completed May 12, 2017
@kiler129
Copy link
Contributor Author

kiler129 commented May 12, 2017

@xabbuh: Perfect, thank you.

Edit:
I just realized it's possible to do that without custom loaders - you can use wildcards in routing resource imports like so:

bundle_routes:
    resource: "../../src/*/Configuration/routing.yml"

@lucascdsilva
Copy link

@xabbuh @kiler129 Hi, does this work in symfony 4? I'm starting to use symfony and I ended up with the same question about how to dynamically load routes.

@sstok
Copy link
Contributor

sstok commented Apr 30, 2018

@lucascdsilva Have a look at https://github.com/rollerworks/RouteAutowiringBundle 👍

@lucascdsilva
Copy link

@sstok tanks, I will look

@chiqui3d
Copy link

chiqui3d commented Aug 2, 2020

I find it incredible that this does not exist, and the bundle cannot be completely isolated and does not depend on the global configuration, and I don't like the idea of creating a recipe to write in the global system configuration. 🔥

thanks @sstok

@chiqui3d
Copy link

chiqui3d commented Aug 3, 2020

Finally I have used the solution the @kiler129, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants