What is the first event fired in Magento?


Technically, it’s resource_get_tablename, but the first usable event is controller_front_init_before.

But this is also a bit of a trick question. controller_front_init_before is ONLY triggered from the global area. The first usable event in the frontend (or adminhtml) area is controller_action_predispatch. core_locale_set_locale might also be a possibility because it is set when the area is loaded, but I would say that controller_action_predispatch is still the best, first usable event once the area is known.

But it gets even more interesting.

The first usable event in the API is actually controller_front_init_before. In api.php both the global and the adminhtml areas are loaded before execution whereas in the regular requests it is not. So if you want to execute an observer only in the API you can have it listen on the adminhtml area on the controller_front_init_before event.

3 Thoughts to “What is the first event fired in Magento?”

    1. I believe the event is “going to get a coffee because it’s taking so long for the page to load”.

Leave a Reply

Your email address will not be published.