addHandler(function () { echo "First handler\n"; }); // If a handler returns true, it will prevent any further handlers from firing $handler->addHandler(function () { echo "Second and final handler\n"; return true; }); // Thus, this one will not be called $handler->addHandler(function() { echo "Third handler, never called\n"; }); // Dispatch the signal to ourselves (new Signal(SIGUSR1))->dispatch(posix_getpid()); // Default target of dispatch is the own pid (new Signal(SIGUSR1))->dispatch();