简体   繁体   中英

Symfony Routing or Symfony Annotations?

I am starting a new symfony web app and i want this project to be as clean as possible. I can't make the decision between routing annotations or base symfony routing in my routes.yml file. Is there any pros and cons to either?

In production, they are both exactly the same - the annotations and/or routing configuration files (be they yaml, xml or php sourced) are all compiled into an optimised regex that is matched from the URL path, to the controller action.

I tend towards mostly annotations on controllers actions (keeping the config close to the actions, as phpdoc annotations), and yaml routing files for the more general other routes, such as redirections.

It is entirely your choice as to where they are put.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM