All Projects → eXolnet → Laravel Heartbeat

eXolnet / Laravel Heartbeat

Licence: mit
Periodically schedule a job to send a heartbeat to a monitoring system.

Projects that are alternatives of or similar to Laravel Heartbeat

Eye
Eyewitness.io package for Laravel 5 applications
Stars: ✭ 114 (+132.65%)
Mutual labels:  laravel, laravel-package, monitoring
Laravel Api Health
Monitor first and third-party services and get notified when something goes wrong!
Stars: ✭ 65 (+32.65%)
Mutual labels:  laravel, laravel-package, monitoring
Chatify
A Laravel package that allows you to add a complete user messaging system into your new/existing Laravel application.
Stars: ✭ 885 (+1706.12%)
Mutual labels:  laravel, laravel-package
Doorman
Limit access to your Laravel applications by using invite codes
Stars: ✭ 913 (+1763.27%)
Mutual labels:  laravel, laravel-package
Cms
Statamic 3: The Core Composer Package
Stars: ✭ 965 (+1869.39%)
Mutual labels:  laravel, laravel-package
Laravel Aws Sns
Laravel package for the AWS SNS Events
Stars: ✭ 24 (-51.02%)
Mutual labels:  laravel, laravel-package
Blade Migrations Laravel
An intelligent alternative version of Laravel 5/6 Database Migrations - uses raw-sql syntax, transactions, auto-rollback, UP-DOWN-UP testing
Stars: ✭ 25 (-48.98%)
Mutual labels:  laravel, laravel-package
Laravel Multilang
Package to integrate multi language (multi locale) functionality in Laravel 5.x.
Stars: ✭ 47 (-4.08%)
Mutual labels:  laravel, laravel-package
Laravel Uptime Monitor
A powerful and easy to configure uptime and ssl monitor
Stars: ✭ 837 (+1608.16%)
Mutual labels:  laravel, monitoring
Laravel Translatable
It's a Laravel database translations manager
Stars: ✭ 47 (-4.08%)
Mutual labels:  laravel, laravel-package
Laravel Qrcode Ecommerce
This is a complete laravel project that handles qrcodes, payments, api/microservices, and ecommerce
Stars: ✭ 36 (-26.53%)
Mutual labels:  laravel, laravel-package
Laravel Compass
A REST client inside your Laravel app
Stars: ✭ 1,002 (+1944.9%)
Mutual labels:  laravel, laravel-package
Eloquent Ldap
A Laravel 5.1 package that first tries to log the user against the internal database if that fails, it tries against the configured LDAP/AD server.
Stars: ✭ 19 (-61.22%)
Mutual labels:  laravel, laravel-package
Simple Cache
An easy to use Caching trait for Laravel's Eloquent Models.
Stars: ✭ 19 (-61.22%)
Mutual labels:  laravel, laravel-package
Laravel Mailguneu
Allow customising the Mailgun server URL to use EU servers.
Stars: ✭ 13 (-73.47%)
Mutual labels:  laravel, laravel-package
Laravel Log
Simple API to write logs for Laravel.
Stars: ✭ 19 (-61.22%)
Mutual labels:  laravel, laravel-package
Laravel Database Logger
Log database query sql in Laravel Application, support Guard,Auth to multiple file record
Stars: ✭ 31 (-36.73%)
Mutual labels:  laravel, laravel-package
History Tracker
Laravel Model history tracking made easy
Stars: ✭ 46 (-6.12%)
Mutual labels:  laravel, laravel-package
Laravel Blade Directives
A collection of nice Laravel Blade directives
Stars: ✭ 813 (+1559.18%)
Mutual labels:  laravel, laravel-package
Package Skeleton
📦 My base for PHP packages.
Stars: ✭ 6 (-87.76%)
Mutual labels:  laravel, laravel-package

Laravel Heartbeat

Latest Stable Version Software License Build Status Total Downloads

Periodically schedule a job to send a heartbeat to a monitoring system.

Installation

Require this package with composer:

composer require exolnet/laravel-heartbeat

If you don't use package auto-discovery, add the service provider to the providers array in config/app.php:

Exolnet\Heartbeat\HeartbeatServiceProvider::class

And the facade to the facades array in config/app.php:

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

Configuration

In order to edit this package's default configuration (where for example you can define presets and configure queue monitoring), you may execute:

php artisan vendor:publish --provider="Exolnet\Heartbeat\HeartbeatServiceProvider"

After that, the configuration file config/heartbeat.php will be created. This file contains all the options that can be configured for this package. The default configuration file can be found here.

Usage

Sending Signals

Using The Heartbeat Facade

You may send heartbeat signals via the Heartbeat facade. To do so, specify the channel you want to use and call the signal method with the arguments required by this channel. For example, with the Http channel, it may look like this:

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

Alternatively, you may send the same signal using method helpers defined in the Heartbeat facade by calling the driver method directly:

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

Using Artisan

Heartbeat can also be used with the heartbeat Artisan command. To do so, specify the channel and specify the channel's arguments in the same order as their signal method. Here two examples of how to use it:

php artisan heartbeat preset preset-name
php artisan heartbeat http https://beats.envoyer.io/heartbeat/example

Specifying Presets

The handy preset channel allows you to define all your heartbeat configuration in the configuration file. First, let's look at an example of a preset configuration:

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

This configuration can now be used by the preset channel to invoke the signal method on the http channel:

Heartbeat::preset('envoyer');

Heartbeat's default configuration list for each channel all the parameters required.

Queue Monitoring

Heartbeat can also be used to monitor your Laravel queue system. This feature is enabled by default when you have Laravel's scheduler enabled. The preset queue is used and a file named queue.heartbeat will be created in your storage/app folder every fifteen minutes.

To configure this, just publish the package configuration and update the queue preset.

Available Channels

Disk

Channel used to store heartbeats in a Laravel Filesystem disk.

File

Channel used to store heartbeats in a file

Http

Channel used to make a heartbeat by calling a url

Custom Channels

Heartbeat ships with a handful of channels, but you may want to write your own drivers to deliver signals via other channels. In order to do so, define a class that contains a signal method. This method should receive as many parameters that you need to send the signal:

<?php

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.
    }
}

Once your channel class has been defined, you may extend Heartbeat's driver to add yours. This could be added to a service provider in the boot method:

<?php

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

Finally, you can now use your driver like native one:

Heartbeat::custom('someOption', ['more' => 'options']);

Testing

To run the phpUnit tests, please use:

composer test

Contributing

Please see CONTRIBUTING and CODE OF CONDUCT for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

This code is licensed under the MIT license. Please see the license file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].