Listen to Supervisor events in PHP

v0.2.0 2020-07-06 05:43 UTC

This package is auto-updated.

Last update: 2024-06-12 09:50:00 UTC


Latest Version Software License Total Downloads Test Suite

Listen to Supervisor events in PHP.


Via Composer

$ composer require supervisorphp/event


Supervisor has this pretty good feature: notify you(r listener) about it's events.

The main entry point is the Listener. Listenerss wait for a Handler in the main listening logic. Handlers get a Notification when an event occurs.

$handler = new \Supervisor\Event\Handler\CallbackHandler(function(\Supervisor\Event\Notification $notification) {
	echo $notification->getHeader('eventname');

$listener = new \Supervisor\Event\Listener\StandardListener;

Currently available listeners:

  • Standard: Listents to standard input stream, writes to standard output
  • Guzzle: Uses StreamInterface to provide an easy interface for reading/writting

Additionally you can use two exceptions to control the listeners itself:

  • Supervisor\Exception\StopListenerException: indicates that the Listener should stop listening for further events.
  • Supervisor\Exception\EventHandlingFailedException: indicates that handling the event failed, Listener should return with a FAIL response.

Any other unhandled exceptions/errors will cause the listener to stop.

Check the Supervisor docs for more about Events.


phpspec run


Please see CONTRIBUTING for details.



The MIT License (MIT). Please see License File for more information.