Symfony - Switching from routing.yml to routing.php


I’m new to symfony. I can’t manage to switch from routing.yml to routing.php. I’ve changed the corresponding line in config.yml :

resource: “%kernel.root_dir%/config/routing.php”

…but the framework is still calling routing.yml, ignoring my routes.

There must be other config items that are to be tweaked, but I can’t figure which.

Best regards,


I might be wrong, as I haven’t tested it, but if you just have your RouteCollection creating PHP file saved under /app/config/routing.php and no other routing file in the /app/config directory, Symfony should just pick it up and use it.


Well, no. During instalation, symfony3 has created all its app/config files (including routing) in .yml and whatever I tries, will always relies on routing.yml for routing.

I kept searching the doc, but nothing came up.

Have you created an /app/config/routing.php file and removed the routing.yml file?


In addition to updating config.yml you also need to update routing_dev.yml

    resource: routing.php # Change from routing.yml

It is the multiple environments that you were having problems with.

1 Like

Bravo, ahundiak, that was it. config.yml and routing_dev.yml have to be modified.

Thans all for the help.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.