Skip to content

hellomayaagency/laravel-heartbeat

Repository files navigation

Monitor Laravel Queue and Schedule

This package runs a queued job and a scheduled command once every 5 minutes and a route to check that this has happened successfully.

This route will return a 200 or a 503 HTTP status which is useful for monitoring software such as StatusCake.

Limitations

This package relies on the database queue driver being used.

Installation

Install the package via composer:

composer require hellomayaagency/laravel-heartbeat

Enable the scheduled heartbeat command:

// app/Console/Kernel.php

protected function schedule(Schedule $schedule)
{
    // ...

    // Note: don't change the interval!
    $schedule->command('heartbeat')->everyFiveMinutes();
}

Run the heartbeat command:

php artisan heartbeat

Add a route to the heartbeat status page:

// routes/web.php
Route::get('heartbeat', '\Maya\LaravelHeartbeat\Http\Controllers\HeartbeatController@index');

// or

Route::get('heartbeat', [HeartbeatController::class, 'index');

Usage

Navigate to the route you created above, e.g. example.com/heartbeat. You should see a status page.

The status page will return a 200 status page if everything is working as expected.

If problems are found with the schedule or queue a 503 status will be returned instead.

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email jake@maya.agency instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

About

Monitor Laravel queue and schedule status

Resources

License

Stars

Watchers

Forks

Packages

No packages published