承接 statsig/ip3country 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

statsig/ip3country

最新稳定版本:v0.1.0

Composer 安装命令:

composer require statsig/ip3country

包简介

IP address to 2-letter country code lookup

README 文档

README

This is a zero-dependency, super small, IP address to 2-letter country code lookup library. There are already several libraries available, but none met our requirements for binary size and speed.

This project in its entirety is <500KB, compared to most alternatives out there that are north of 40MB (but might provide more than just countries).

The database used in this project is compacted from IP2Location. Their DB1.LITE edition is provided under CCA, with the attribution below:

NOTE

This site or product includes IP2Location LITE data available from https://lite.ip2location.com.

Usage

$ composer require statsig/ip3country
// import
require_once __DIR__ . '/../vendor/autoload.php';
use ip3country\IP3Country;

// Initialize
$ip3c = new IP3Country();

// Lookup using ip4 str
echo $ip3c->lookup("1.1.1.1"); // 'US'
echo $ip3c->lookup("123.45.67.8"); // 'KR'

// Lookup using numeric ip
echo ip3country.lookupNumeric(2066563848)); // 'KR'

Tests

./vendor/bin/phpunit tests/TestCountries.php

Accuracy

ip3country's accuracy is dependent on IP2Location LITE's accuracy. In our experience, for country lookups, it is accurate enough for most applications.

IP2Location publishes accuracy reports here: https://www.ip2location.com/data-accuracy

There's also this third party report available: https://www.cl.cam.ac.uk/~nz247/publications/JSAC2011-Geolocation.pdf

Name

All variants of "ip2country" were already taken in npm, so we decided to step it up.

Motivation

At Statsig, we needed a library to evaluate location-based conditions on Feature Gates (Feature Flags). We use ip3country to power country-level rollouts or A/B tests for new features.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: ISC
  • 更新时间: 2022-01-20