GithubHelp home page GithubHelp logo

aknife2019 / ip Goto Github PK

View Code? Open in Web Editor NEW
17.0 1.0 3.0 99.61 MB

IP地理位置获取。支持获取IPv4、IPv6地址信息。包括:国家、省份、城市。

License: MIT License

PHP 100.00%
ip-database php-ip qqwry qqwry-mmdb maxmind

ip's Introduction

概述

IP地理位置获取。支持获取IPv4、IPv6地址信息。包括:国家、省份、城市。

国内数据使用纯真IPV4库,结合 ipip,ip138 API 补齐国内空白城市数据,并打包为mmdb格式

测试地址:https://ip.aknife.cn/

安装

composer require aknife/ip

快速入门

示例代码

// 获取IP信息
use Aknife\Ip\IpInfo;

// IPv4
IpInfo::find('159.75.190.197');
/*
[
    'continent' => [
            'code' => 'AS',
            'name' => '亚洲',
    ],
    'country' => [
            'code' => 'CN',
            'name' => '**',
    ],
    'region' => '广东省',
    'city' => '广州市',
]
*/
// IPv4 en
IpInfo::find('159.75.190.197','en');
/*
[
    [continent] => [
            [code] => 'AS',
            [name] => 'Asia',
    ],
    [country] => [
            [code] => 'CN',
            [name] => 'China',
    ],
    [region] => 'Guangdong',
    [city] => 'Guangzhou'
]
*/

// IPv6
IpInfo::find('2402:4e00:1013:e500:0:940e:29d7:3443','full');
/*
[
    
    'continent' => [
            'code' => 'AS',
            'en' => 'Asia',
            'zh-CN' => '亚洲'
    ],
    'country' => [
            'code' => 'CN',
            'en' => 'China',
            'zh-CN' => '**'
    ],
    'region' => [
            'en' => 'Guangdong',
            'zh-CN' => '广东省'
    ],
    'city' => [
            'en' => 'Guangzhou',
            'zh-CN' => '广州市'
    ]
]
*/

IP库来源

  • 国内IPv4地址来自(qqwry.dat - 2024-04-24) cz88.net
  • 国内IPv6地址来自(ipv6wry.db - 2021-07-21) ZX-Inc/zxipdb-python
  • 国外IP城市信息来自(GeoLite2-City.mmdb - 2024-04-26) maxmind.com

ip's People

Contributors

aknife2019 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ip's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.