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

Phalcon Life Cycle Chart

I'm a Phalcon beginner and have done a few of the sample applications with minimal issues. However, I'm now trying to go beyond the sample apps and extend Phalcon to better suit my needs, but I'm having trouble figuring out when to do what....

That said, is there a Phalcon Webpage Life Cycle chart or some other sequential document that shows how each of Phalcon elements/components/code block/etc... get called and in what order?

@fuzzlog

I'm affraid your question is not so clear. Actually there is no global schema of how phalcon works. Instead you can find the documentation of each components in the doc.

For your question can you explain what you are trying to do exactly ? It will help us to lead you in the good direction.



7.6k
edited Oct '14

In order to output an html document to the client via php/phalcon, Phalcon has to go through a series of steps as it goes from receiving the request, setting up its modules/classes/data structures/etc... so that eventually it produces the html that will be sent to the client browser.

What I'd like to know is if there is a document (something similar to this asp.net page/control lifecycle image that I can use to better find out in what sequence things work in Phalcon so I can figure out where I can inject any custom or overriding code I need to write to make Phalcon work better for me.

edited Oct '14

This kind of schema is pretty handy but as far as I know phalcon doesnt have.

However you can take a read at https://docs.phalcon.io/en/latest/reference/dispatching.html it will tell you more about the dispatch loop and the events that you can access.

If you have any more question about it feel free to ask.



7.6k

Thanks for the info. I will give it a thorough read. However, is there anything else that Phalcon runs through before entering the "dispatch loop"? How about after? How does someone that is just starting and has little time to do trial and error or thorough research get to know this info (ie, not everyone has time to constantly check on forum answers)?

Sorry if that sounded negative, I'm just having a hard time getting the whole concept of how Phalcon works even though I'm using the forums, documentation samples and api documentation.

edited Oct '14

You are right, phalcon documention is something that has to be reviewed. (actually same occured for me when i started with phalcon).

You have to know that the phalcon team is aware of the global documentation problem, but today they are more focused on phalcon 2. I'm pretty sure they plan to improve the documentation with the version 2. Anyway your feedback is appreciated !

About the dispatch loop there are of course some other things that happen, but most of the job is done by the dispatcher (and the controller that itself is controlled by the dispatcher), there is also the routing, the view, the response, etc..., but dispatcher event are enough to handle most of the cases you are looking for. Actually if there was a schema to draw, the dispatcher would cover most of the picture.

PS : you can go on the IRC : https://forum.phalcon.io/discussion/225/irc-phalconphp some people may help you in a different way.

Edit : stay tuned about the schema. Maybe something will pop out in the coming days.