kormik kormik - 10 months ago 27
PHP Question

How to add route to a controller in custom directory?

In Symfony 3 I am trying to load routing from controllers which are not in a bundle using a directory path, but parameter

is not resolved here. It works if I use absolute path.

My routing.yml file:

resource: '%kernel.root_dir%/../src/MyModule/Controller'
type: annotation
prefix: /mymodule

Do you have any suggestion how to use relative path without referencing a bundle?


You can use a path relative to the current config file:

resource: ../../src/MyModule/Controller