shimomo/laravel-ping

Ping for Laravel.

2.3.0 2017-05-19 15:45 UTC

This package is auto-updated.

Last update: 2024-11-11 04:44:09 UTC


README

Build Status Coverage Status Latest Stable Version Total Downloads Dependency Status MIT License

Installation

Install via Composer.

$ composer require shimomo/laravel-ping

Add to config/app.php.

<?php

return [

    // ...

    'providers' => [
        // ...
        Shimomo\Laravel\PingServiceProvider::class,
    ],

    // ...

    'aliases' => [
        // ...
        'Ping' => Shimomo\Laravel\PingFacade::class,
    ],
];

Usage

<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;

/**
 * @author shimomo
 */
class PingController extends Controller
{
    /**
     * @return string
     */
    public function execute()
    {
        if ($latency = \Ping::execute('https://example.com/')) {
            return $latency . 'ms';
        }

        return 'Not exist.';
    }
}

License

Laravel Ping is open-sourced software licensed under the MIT license.