PHP code example of olssonm / horizon-status

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

    

olssonm / horizon-status example snippets

 php
// app/Console/Commands/HorizonIsRunning.php
use Olssonm\HorizonStatus\Facade\HorizonStatus;

public function __handle() {
    if(!HorizonStatus::isActive()) {
        // Notify admin (not via the Horizon-queue of course...)
    }
}

// app/Console/Kernel.php
protected function schedule(Schedule $schedule) {
    $schedule->command('horizon:is-running')->everyFiveMinutes();
}
 php
use Olssonm\HorizonStatus\Facade\HorizonStatus;

HorizonStatus::isActive();
// true
 php
use Olssonm\HorizonStatus\Facade\HorizonStatus;

HorizonStatus::isInactive();
// false
 php
use Olssonm\HorizonStatus\Facade\HorizonStatus;

HorizonStatus::isPaused();
// false