karlmonson/laravel-ping
Simple Ping For Laravel Applications
40,730
29
| Install | |
|---|---|
composer require karlmonson/laravel-ping |
|
| Latest Version: | 1.0.7 |
| Laravel: | 5 · 6 · 7 |
| License: | MIT |
| Last Updated: | Jun 15, 2023 |
| Links: | GitHub · Packagist |
Maintainer: karlmonson
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 karlmonson/laravel-ping
You'll need to register the ServiceProvider and Facade:
// config/app.php
'providers' => [
// ...
Karlmonson\Ping\PingServiceProvider::class,
];
'aliases' => [
// ...
'Ping' => Karlmonson\Ping\Facades\Ping::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
- Eric Blount - Inspiration (ericmakesstuff/laravel-server-monitor)
License
The MIT License (MIT). Please see License File for more information.
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
648,266,899
9,701
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
429,221,767
607
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
403,217,078
4,664
Version History
| Version | Released | Laravel | License |
|---|---|---|---|
| 1.0.7 | ^5.1 || | MIT | |
| 1.0.6 | ^5.1 || | MIT | |
| 1.0.4 | ^5.1 | MIT | |
| 1.0.2 | ^5.1 | MIT | |
| 1.0.1 | ^5.1 | MIT | |
| 1.0.0 | ^5.1 | MIT |