omatech/laravel-check-supervisor 问题修复 & 功能扩展

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

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

omatech/laravel-check-supervisor

Composer 安装命令:

composer require omatech/laravel-check-supervisor

包简介

README 文档

README

Command to check that Supervisor is running and automatically restart it.

Installation

1.- Require the package in your composer.json.

composer require omatech/laravel-check-supervisor

2.- Register the service provider.

    // config/app.php
    
    'providers' => [
        ...
        Omatech\CheckSupervisor\CheckSupervisorServiceProvider::class,
        ...
    ];

3.- Optionally, you can publish the config file of the package if you want to use the automatic restart option

php artisan vendor:publish 

And then, select:

Omatech\CheckSupervisor\App\Providers\PublishServiceProvider

Usage

1.- Use the command to know if supervisor is down. You can automate it in your crontab.

php artisan supervisor:check

2.- Create a listener to capture the package events. Here you can create your custom notification. Example:

php artisan make:listener SupervisorListener
<?php

namespace App\Listeners;

use App\Mail\YourCustomEmail;
use Illuminate\Support\Facades\Mail;

class SupervisorListener
{
    protected $log;

    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct($log = null)
    {
        $this->log = $log;
    }

    /**
     * Handle the event.
     *
     * @param  object  $event
     * @return void
     */
    public function handle($event)
    {
        Mail::to('me@example.com')->send(new YourCustomEmail($this->log));
    }
}

You can capture feedback from the package using a param in __construct.

3.- Register the events and listeners in your EventServiceProvider. Example:

    protected $listen = [
        ... 
        
        SupervisorIsNotRunning::class => [
            SupervisorListener::class
        ],
        SupervisorRestarted::class => [
            SupervisorListener::class
        ]
        
        ...
    ];

4.- If you want to activate the automatic restart option, set the variable restart-supervisor in the configuration file check-supervisor.php to true.

    return [
        'restart-supervisor' => true
    ];

Credits

Special thanks

Organization

Contributors

See the contributors list here.

License

MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固