Support for Events in n98-magerun

In version 1.77.0 we added the Symfony EventManager compontent to n98-magerun.
The event manager let you hook in the core commands.

Currently there are three core events which are available:

console.command – Before a command runs

console.terminate – After a command execution

console.exception – If a command stops with an exception

How can i register an observer?

n98-magerun support registration of Symfony subscriber objects.
This can easily done by a config.

You should define your subscriber class in config node “event -> subscriber”.

The subscriber class must implement EventSubscriberInterface.

Example:

The system is simple. All subscribers return a list of subscribed events.
If a event is dispatched all subsribers will be called automatically.
In our example we should see the name of any command in our terminal.
This offers you new features like a output logger.

We will add more events in the future which let you extend the core functions of n98-magerun.

Happy Coding!