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

How do URL components work?

Is there a diagram showing the Phalcon request flow?

Specifically, it is not clear how Phalcon matches Controllers and Views. The View page (https://docs.phalcon.io/en/latest/reference/views.html), shows how URLs are broken down into components, but what happens when a component is missing?

For example, the URL, https://127.0.0.1/blog/posts/show/301, what happens if you don't specify an action? I suspect it will be blank then. Why is there an action, since isn't this what POST, GET, and PUT is for?

And what is the "Phalcon Directory" directory mentioned on https://docs.phalcon.io/en/latest/reference/views.html? Is this a suffix added to the directories passed to registerDirs()?

POST, GET, and PUT is a HTTP request method type. Action is certain class method in controller that serve get,post, and put request from user and return back a response to the user. Which controller, and which action will be used to serve the request is determined by the router and dispatcher. The default pattern for the router to determine which controller and action is: baseuri/:controller/:action/:params, so url in your example would execute postsController::showAction with params of[301] (assuming https://127.0.0.1/blog is the base uri). You can customise the routing so that you can control which action,controller, and module should be used in https://docs.phalcon.io/en/latest/reference/routing.html. If you want to know the detail workflow of how routing, dispatching, and chosing view works, please read: https://docs.phalcon.io/en/latest/reference/applications.html#manual-bootstraping