PHP code example of omatech / laravel-check-supervisor

1. Go to this page and download the library: Download omatech/laravel-check-supervisor 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/ */

    

omatech / laravel-check-supervisor example snippets


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



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('[email protected]')->send(new YourCustomEmail($this->log));
    }
}

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

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

php artisan vendor:publish 
 
php artisan supervisor:check
 
php artisan make:listener SupervisorListener
__construct
check-supervisor.php