Skip to content

LuminFire/BetterUptime-Laravel

Repository files navigation

Laravel BetterUptime

Latest Version on Packagist Total Downloads

This packages provides a route for BetterUptime to monitor and excludes it from Telescope monitoring.

It also enables BetterUptime heartbeat monitoring.

cover image

Installation

You can install the package via composer:

composer require brilliant-packages/betteruptime-laravel

You can publish the config file with:

php artisan vendor:publish --provider="BrilliantPackages\BetterUptimeLaravel\BetterUptimeLaravelServiceProvider" --tag="betteruptime-laravel-config"

This is the contents of the published config file:

return [
    'monitor' => [
        'enabled' => env('BETTER_UPTIME_MONITOR_ENABLED', true),
        'path' => env('BETTER_UPTIME_MONITOR_PATH', 'better-uptime'),
    ],

    'heartbeat' => [
        'enabled' => env('BETTER_UPTIME_HEARTBEAT_ENABLED', true),
        'url' => env('BETTER_UPTIME_HEARTBEAT_URL'),
        'minutes' => env('BETTER_UPTIME_HEARTBEAT_FREQUENCY', 5),

        'retry' => [
            'count' => env('BETTER_UPTIME_HEARTBEAT_RETRY_COUNT', 5),
            'delay' => env('BETTER_UPTIME_HEARTBEAT_RETRY_DELAY', 3000),
        ],
    ],
];

Usage

Monitoring

Create a BetterUptime monitor using https://{yourDomain}/better-uptime as the URL (you can change the path using the BETTER_UPTIME_MONITOR_PATH environment variable).

You can either set BetterUptime to alert you when it “Becomes unavailable” or “Doesn’t contain keyword”; if you choose the keyword method, use your app’s name (APP_ENV environment variable) or “BetterUptime” as the keyword.

To disable the route, set BETTER_UPTIME_MONITOR_ENABLED=false.

Heartbeat

Create a BetterUptime heartbeat monitor with your desired name, frequency, and grace period.

Determine the frequency in minutes (e.g., 1 hour = 60, 1 day = 1440, etc.) and set these environment variables:

BETTER_UPTIME_HEARTBEAT_URL=https://betteruptime.com/api/v1/heartbeat/abc123
BETTER_UPTIME_HEARTBEAT_FREQUENCY=5

To disable heartbeat monitoring, remove the BETTER_UPTIME_HEARTBEAT_URL or set BETTER_UPTIME_HEARTBEAT_ENABLED=false.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

About

BetterUptime integration with Laravel

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published