laravel-web-status-checker maintained by cookiemc337
Description
Simple Ping For Laravel Applications
Authors
Last update
2022/11/27 14:52
(dev-master)
License
Downloads
9
Ping for Laravel
This Laravel package is simple and unopinionated. It simply returns the HTTP Status Code for a provided URL.
Installation
Install via Composer:
composer require cookiemc337/laravel-web-status-checker
You'll need to register the ServiceProvider and Facade:
// config/app.php
'providers' => [
// ...
CookieMC337\Checker\WebStatusCheckerServiceProvider::class,
];
'aliases' => [
// ...
'WebStatusChecker' => CookieMC337\Checker\Facades\WebStatusChecker::class,
];
Usage
<?php
namespace App\Http\Controllers;
use Ping;
use App\Http\Controllers\Controller;
class LinkController extends Controller
{
/**
* Show the current health of a given URL.
*
* @param string $url
* @return string
*/
public function healthCheck($url)
{
$health = Ping::check($url);
if($health == 200) {
return 'Alive!';
} else {
return 'Dead :(';
}
}
}
Credits
- Karl Monson - Author
- Julien Herwig - Renamed and added more Checks
- Eric Blount - Inspiration (ericmakesstuff/laravel-server-monitor)
License
The MIT License (MIT). Please see License File for more information.