brilliant-packages / betteruptime-laravel
BetterUptime Monitoring and Heartbeats
Fund package maintenance!
LuminFire
Installs: 7 045
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 0
Open Issues: 1
Requires
- php: ^7.4 || ^8.0
- illuminate/contracts: *
- spatie/laravel-package-tools: ^1.1
Requires (Dev)
- guzzlehttp/guzzle: ^7.2
- laravel/telescope: ^4.4 || ^5.0
- orchestra/testbench: ^6.0 || ^7.0 || ^8.0
- phpunit/phpunit: ^9.3 || ^10.0 || ^11.0
- spatie/laravel-ray: ^1.9
README
This packages provides a route for BetterUptime to monitor and excludes it from Telescope monitoring.
It also enables BetterUptime heartbeat monitoring.
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.