PHP code example of innmind / signals

1. Go to this page and download the library: Download innmind/signals library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

innmind / signals example snippets


use Innmind\Signals\{
    Handler,
    Signal,
    Info,
};

$handler = new Handler; // automatically enable async signal at instanciation

$handler->listen(Signal::interrupt, function(Signal $signal, Info $info): void {
    echo 'foo';
});
$handler->listen(Signal::interrupt, function(Signal $signal, Info $info): void {
    echo 'bar';
});

// do some logic here