ZF2 Basics

To understand a framework we should first know a little bit about its structure. To understand zend framework at first hand we should know and remember by heart that zend framework is an event driven framework. At first event driven framework rings alot of bell in our heads like how can you fire an event with a scripting language. How will it going to fire a click event or keypress event and so on and so forth. This word strikes us so hard that we neglect it and move forward.

But as a matter of fact we should sit back and relax our selves. Lets start from the beginning that what is meant by event driven framework and what events are there which gets fired plus what is the use of it. If event driven term giving you a headache than lets make it a bit easier for you and lets us replace it with HOOKS. I'm sure most of you are familiar with hooks.

So when does a hook/event gets fired. Zend framework teaches us to follow some guide lines when firing hooks/events. The hooks/events should always starts with a pre* prefix and ends with post* prefix. Meaning if you intend to fire a hook/event in your code than it will be like preCooking and postCooking. This event firing let other developers know that they can inject there code in it when ever they like. So in my previous post I told you guys that we as developer should allow people to add flavor according to their liking. So firing events is the way to let others add flavors according to their liking.