定制 lindelius/php-checkip 二次开发

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

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

lindelius/php-checkip

最新稳定版本:0.1

Composer 安装命令:

composer require lindelius/php-checkip

包简介

A minimal, PSR based library for checking the public IP of the host machine.

关键字:

README 文档

README

CircleCI

A minimal, PSR based library for checking the public IP of the host machine.

Installation

If you are using Composer, you may install the latest version of this library by running the following command from your project's root folder:

composer require lindelius/php-checkip

You may also manually download the library by navigating to the "Releases" page and then expanding the "Assets" section of the latest release.

Usage

The included implementation(s) of IpCheckerInterface are all PSR based, meaning they all rely on PSR compatible HTTP clients and request factories. One example of such a library is the popular Guzzle library, which also happens to be used in the code snippet below:

use Lindelius\CheckIp\Exception\IpCheckerException;
use Lindelius\CheckIp\IpAddress;
use Lindelius\CheckIp\IpChecker\AwsIpChecker;

$ipChecker = new AwsIpChecker(
    new \GuzzleHttp\Client(["verify" => false]),
    new \GuzzleHttp\Psr7\HttpFactory(),
    // <-- Optional PSR compatible logger
);

try {
    /** @var IpAddress $ipAddress */
    $ipAddress = $ipChecker->checkIp();
    
    echo $ipAddress->value; // A valid IPv4 or IPv6 address
    echo $ipAddress->type->value; // ipv4 | ipv6
} catch (IpCheckerException $ex) {
    // TODO: Handle potential errors
}

Logging

You may optionally include a PSR compatible logger when instantiating an IP checker in order to get access to internal debug information. Please note, though, that this information will only be available if the logger has been configured to include debug messages.

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2025-01-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固