PHP code example of exolnet / laravel-heartbeat

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

    

exolnet / laravel-heartbeat example snippets


Exolnet\Heartbeat\HeartbeatServiceProvider::class

'Heartbeat' => Exolnet\Heartbeat\HeartbeatFacade::class

Heartbeat::channel('http')->signal('https://beats.envoyer.io/heartbeat/example');

Heartbeat::http('https://beats.envoyer.io/heartbeat/example');

'presets' => [
    'envoyer' => [
        'channel' => 'http',
        'url' => 'https://beats.envoyer.io/heartbeat/example',
    ],
]

Heartbeat::preset('envoyer');



namespace App\Heartbeats;

class CustomChannel
{
    /**
     * Send a heartbeat signal.
     *
     * @param string $someOption
     * @param array $moreOptions
     * @return void
     */
    public function signal($someOption, array $moreOptions = [])
    {
        // Send the signal according to the specified options.
    }
}



namespace App\Providers;

use App\Heartbeats\CustomChannel;
use Heartbeat;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;

class AuthServiceProvider extends ServiceProvider
{
    /**
     * @return void
     */
    public function boot()
    {
        Heartbeat::extend('custom', function($app) {
            return $app->make(CustomChannel::class);
        });
    }
}

Heartbeat::custom('someOption', ['more' => 'options']);
bash
php artisan vendor:publish --provider="Exolnet\Heartbeat\HeartbeatServiceProvider"