PHP code example of sergeich5 / php-supervisor-status-checker

1. Go to this page and download the library: Download sergeich5/php-supervisor-status-checker 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/ */

    

sergeich5 / php-supervisor-status-checker example snippets




// MyCallbackHandler.php

class MyCallbackHandler extends \Sergeich5\SupervisorStatusChecker\Callback\CallbackHandler
{
    function onBeforeTick()
    {
        // YOUR LOGIC HERE
    }

    function onAfterTick()
    {
        // YOUR LOGIC HERE
    }
    
    function onFatal(string $processName)
    {
        // YOUR LOGIC HERE
    }

    function onRunning(string $processName)
    {
        // YOUR LOGIC HERE
    }

    function onStarting(string $processName)
    {
        // YOUR LOGIC HERE
    }

    function onBackoff(string $processName)
    {
        // YOUR LOGIC HERE
    }

    function onStopped(string $processName)
    {
        // YOUR LOGIC HERE
    }

    function onUnknown(string $processName, string $status)
    {
        // YOUR LOGIC HERE
    }
}

$loop = new \Sergeich5\SupervisorStatusChecker\Checker(
    new MyCallbackHandler(),
    true,
    false
);

$loop->checkLoop( int DELAY_IN_SECONDS );

$loop->checkOnce();