We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Pros and Cons of routing via Annotations

I have checked this


and it seems to me that defining the routes via annotations is better because you have routes and controllers in one file instead of two files (better for maintainance) etc.

What are pros and cons of using annotations exclusively?

Is it a bad idea?

Or is it OK and I just need to set the basic default controller and 404 page in the routes.php?

Does using annotations slow down the website more than using just routes.php?

Share your thoughts on this subject, please.


Annotations might require an extra processing stage that plain PHP does not require. You can cache the routes in APC/Xcache to reduce the processing time of annotations. https://docs.phalcon.io/en/latest/reference/annotations.html#annotations-adapters