malvik-lab/ip-api-client 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

malvik-lab/ip-api-client

最新稳定版本:1.0.1

Composer 安装命令:

composer require malvik-lab/ip-api-client

包简介

A PHP library for interfacing with ip-api.com, providing geolocation details based on an IP address.

README 文档

README

This unofficial library provides a simple interface to interact with the ip-api.com service, allowing you to obtain geographic information based on the IP address.

Installation

You can install this library using Composer. Run the following command:

composer require malvik-lab/ip-api-client

Usage

Example of Use

<?php

require_once __DIR__ . '/vendor/autoload.php';

use GuzzleHttp\Client;
use MalvikLab\IpApiClient\IpApiClient;

$ipApiClient = new IpApiClient(new Client());
$ipData = $ipApiClient->get('8.8.8.8');

Available Methods

  • get($ip): Gets details about the specified IP address.

Output Example

MalvikLab\IpApiClient\DTO\DataDTO Object
(
    [limit] => MalvikLab\IpApiClient\DTO\LimitDTO Object
        (
            [ttl] => 60
            [rl] => 44
        )

    [ipInfo] => MalvikLab\IpApiClient\DTO\IpInfoDTO Object
        (
            [status] => success
            [country] => United States
            [countryCode] => US
            [region] => VA
            [regionName] => Virginia
            [city] => Ashburn
            [zip] => 20149
            [lat] => 39.03
            [lon] => -77.5
            [timezone] => DateTimeZone Object
                (
                    [timezone_type] => 3
                    [timezone] => America/New_York
                )

            [isp] => Google LLC
            [org] => Google Public DNS
            [as] => AS15169 Google LLC
            [query] => 8.8.8.8
        )

)

Running Test

vendor/bin/phpunit tests --testdox

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-09