crysix/laravel-ping

Simple Ping For Laravel Applications

Installs: 86

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 22

pkg:composer/crysix/laravel-ping

1.0.11 2025-07-25 17:37 UTC

This package is auto-updated.

Last update: 2025-12-25 18:38:27 UTC


README

This Laravel package is simple and unopinionated. It simply returns the HTTP Status Code for a provided URL.

Installation

Install via Composer:

composer require crysix/laravel-ping

You'll need to register the ServiceProvider and Facade:

// config/app.php

'providers' => [
    // ...
    Crysix\Ping\PingServiceProvider::class,
];

'aliases' => [
    // ...
    'Ping' => Crysix\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

License

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