PHP code example of pahenrus / react-signals

1. Go to this page and download the library: Download pahenrus/react-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/ */

    

pahenrus / react-signals example snippets


$loop = React\EventLoop\Factory::create();
$signalsHandler = new Reac\Signals\Handler($loop);

$signalsHandler->on(SIGTERM, function () {
    // Clear some queue
    // Write syslog
    // Do ALL the stuff
    echo 'Bye'.PHP_EOL;
    die();
});

$signalsHandler->on(SIGINT, function () {
    echo 'Terminated by console'.PHP_EOL;
    die();
});

echo 'Started as PID '.getmypid().PHP_EOL;
$loop->run();