2017 © Pedro Peláez
 

library urlchecker

Simple utility package to check the status of a URL (status code, response time etc).

image

viirre/urlchecker

Simple utility package to check the status of a URL (status code, response time etc).

  • Monday, January 29, 2018
  • by viirre
  • Repository
  • 0 Watchers
  • 0 Stars
  • 1,556 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 3 % Grown

The README.md

urlchecker

Latest Version Software License Build Status Quality Score, (*1)

This package let's you check the status of a URL to easily check if it's "online" or not. Uses PSR 1/2. It uses Guzzle for communicating with the URLs., (*2)

Install

Via Composer, (*3)

$ composer require viirre/urlchecker

Usage

require_once 'vendor/autoload.php';

$url = 'http://www.google.com';
$checker = new \Viirre\UrlChecker\Checker();
$status = $checker->check($url);

if ($status->isRespondingOk()) {
    echo "Url {$url} is responding ok, woho!";
} elseif ($status->isRespondingButNotOk()) {
    echo "Url {$url} is responding, but with status code: " . $status->getStatusCode() . " and reason for not a 200: " . $status->getReason();
} elseif ($status->isNotResponding()) {
    echo "Url {$url} is NOT responding ok, fail reason: " . $status->getReason();
}

There are plenty of stuff to check about the connection, to get how long the connection took, use:, (*4)

$timeInSeconds = $status->getTimeInSeconds();
$timeInMilliSeconds = $status->getTimeInMilliSeconds();

And if you want to drill down further, you can access the underlying GuzzleHttp\Message\Response object to access all it's info, eg:, (*5)

$response = $status->getResponse();

// Get protocol info from the response
$protocol = $response->getProtocolVersion();

Checkout the Guzzle Response class with all the available functions at Guzzles API, (*6)

Testing

$ phpunit

Contributing

Please see CONTRIBUTING for details., (*7)

Credits

License

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

The Versions

29/01 2018

dev-master

9999999-dev https://github.com/viirre/urlchecker

Simple utility package to check the status of a URL (status code, response time etc).

  Sources   Download

MIT

The Requires

 

The Development Requires

viirre urlchecker check url status

29/01 2018

v0.3

0.3.0.0 https://github.com/viirre/urlchecker

Simple utility package to check the status of a URL (status code, response time etc).

  Sources   Download

MIT

The Requires

 

The Development Requires

viirre urlchecker check url status

29/01 2018

v0.2

0.2.0.0 https://github.com/viirre/urlchecker

Simple utility package to check the status of a URL (status code, response time etc).

  Sources   Download

MIT

The Requires

 

The Development Requires

viirre urlchecker check url status

24/03 2016

dev-analysis-zD2KJX

dev-analysis-zD2KJX https://github.com/viirre/urlchecker

Simple utility package to check the status of a URL (status code, response time etc).

  Sources   Download

MIT

The Requires

 

The Development Requires

viirre urlchecker check url status

17/04 2015

v0.1

0.1.0.0 https://github.com/viirre/urlchecker

Simple utility package to check the status of a URL (status code, response time etc).

  Sources   Download

MIT

The Requires

 

The Development Requires

viirre urlchecker check url status