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

routing

which one is better in phalcon ? using routing or do not use a routing ?



1.6k
Accepted
answer

There is not a right answer to this unless you consider it limited to a specific project requirements.

There is a cost to using a router, but without one, it's hard to manage a consistent state for your app across multiple end-points, this is why front-controller pattern was created, to have a single point of entry for dynamic requests.

If you don't use routing at all you'll have to manage multiple files to deal with endpoints, and I don't think you can handle restful requests easily.

If you do use routing there is obviously a cost to register routes, to have the expressive and easily readable syntax phalcon provides.

Phalcon is really fast! The cost of routing is incredibly low compared to a laravel project, probably even compared to something like WordPress, which does not have a single front-controller.

Use routing ofcourse. It's much easier and cleaner to maintain your app.