定制 hedii/uptime-checker 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hedii/uptime-checker

Composer 安装命令:

composer require hedii/uptime-checker

包简介

A php library to monitor website uptime

README 文档

README

Build Status

Uptime Checker

A php library to monitor website uptime

Table of contents

Installation

Install via composer

composer require hedii/uptime-checker

Usage

Instantiation

Create a uptime checker instance:

<?php

// require composer autoloader
require '/path/to/vendor/autoload.php';

// instantiate
$checker = new Hedii\UptimeChecker\UptimeChecker();

Alternatively, you can pass a GuzzleHttp\Client instance as a parameter if you want to set your own http client options (see Guzzle documentation):

// instantiate with the http client as a parameter
$checker = new Hedii\UptimeChecker\UptimeChecker(new Client([
    'delay' => 1000,
    'allow_redirects' => false
]));

Perform an uptime check

Call the check($url) method with an url as a parameter to perform the uptime check.

$checker = new Hedii\UptimeChecker\UptimeChecker();
$result = $checker->check('http://example.com');

The result of this method is an array with with the check report information. The value of success indicates if the website is up or down:

array(5) {
    'uri' => "http://example.com"
    'success' => true
    'status' => 200
    'message' => "OK"
    'transfer_time' => 0.765217
}

The result array

Field Type Description
uri string The url to test
success boolean Whether the uptime test is successful or not
status integer The http response status code
message string The http response message or the client error message
transfer_time float The transfer time in seconds

Testing

composer test

License

hedii/uptime-checker is released under the MIT Licence. See the bundled LICENSE file for details.

统计信息

  • 总下载量: 1.06k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 24
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 24
  • Watchers: 1
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固