PHP code example of shimomo / laravel-ping
1. Go to this page and download the library: Download shimomo/laravel-ping library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
shimomo / laravel-ping example snippets
return [
// ...
'providers' => [
// ...
Shimomo\Laravel\PingServiceProvider::class,
],
// ...
'aliases' => [
// ...
'Ping' => Shimomo\Laravel\PingFacade::class,
],
];
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.';
}
}
config/app.php