1. Go to this page and download the library: Download webrek/laravel-health-ui 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/ */
use Webrek\HealthUi\Contracts\Check;
use Webrek\HealthUi\Result;
class RedisQueueDepthCheck implements Check
{
public function name(): string
{
return 'queue_depth';
}
public function run(): Result
{
$depth = Redis::llen('queues:default');
return $depth < 1000
? Result::ok($this->name(), "Queue depth is {$depth}.", ['depth' => $depth])
: Result::warning($this->name(), "Queue is backing up ({$depth}).", ['depth' => $depth]);
}
}