I need to fire off an event, as early as possible in the dispatch process, when a customer visits a frontend controller. The request is to be analysed and will, potentially, be redirected to a different URL, justifying the “as early as possible” requirement.
What’s the earliest event a developer can subscribe to?
The earliest event I’d rely on is
The Magento front controller object (distinct from the the “index.php front controller”) is the object that managers the routers, which in turn manages the action controller dispatch.
There’s a few others (
resource_get_tablename,core_collection_abstract_load_before,core_collection_abstract_load_after) that fire before, but they’re more of the side effect variety (Magento using it’s own systems to bootstrap itself) than anything you’d want to rely on.Finally, as should always be pointed out, if you do a little logging in
app/Mage.phppatterns begin to emerge.