PHP code example of thruster / process-exit-handler

1. Go to this page and download the library: Download thruster/process-exit-handler 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/ */

    

thruster / process-exit-handler example snippets


use Thruster\Component\EventLoop\EventLoop;
use Thruster\Component\ProcessExitHandler\ExitHandler;
use Thruster\Component\ProcessExitHandler\ExitEvent;

$loop = new EventLoop();
$exitHandler = new ExitHandler($loop);

$exitHandler->addHandler(function (ExitEvent $event) {
    // ... Handle event
});

$loop->run();