olssonm/horizon-status 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

olssonm/horizon-status

最新稳定版本:v1.3

Composer 安装命令:

composer require olssonm/horizon-status

包简介

Utility to check the status of Lavarel Horizon instances programmatically

README 文档

README

Latest Version on Packagist Build Status Software License

Laravel Horizon status checker

Simple utility to check the current status of your Laravel Horizon instance programatically.

Why?

Why use this package if the Artisan command horizon:status is available? Because there are times that the need to check the status programatically emerge. For example, if you via scheduling want to make sure that your Horizon-instance is running and you don't want to parse strings or the like:

// 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();
}

Or perhaps you want to have a status-icon clearly visible directly in your blade-template:

@if(HorizonStatus::isActive())
    <div class="success">Horizon is running</div>
@else
    <div class="warning">Horizon is down</div>
@endif

Installation

composer require olssonm/horizon-status

Note – This package requires Laravel Horizon running on either Laravel 8 or 9.

Usage

There are four methods available with this package.

status

Returns one of the three available statuses, active, inactive or paused.

use Olssonm\HorizonStatus\Facade\HorizonStatus;

HorizonStatus::status();
// active

isActive

Return true or false whether status is active:

use Olssonm\HorizonStatus\Facade\HorizonStatus;

HorizonStatus::isActive();
// true

isInactive

Return true or false whether status is inactive:

use Olssonm\HorizonStatus\Facade\HorizonStatus;

HorizonStatus::isInactive();
// false

isPaused

Return true or false whether status is paused:

use Olssonm\HorizonStatus\Facade\HorizonStatus;

HorizonStatus::isPaused();
// false

License

The MIT License (MIT). Please see the LICENSE.md for more information.

© 2022 Marcus Olsson.

统计信息

  • 总下载量: 555
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-06-14