PHPackages                             wakumaku/ip2c - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wakumaku/ip2c

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wakumaku/ip2c
=============

Small and simple library to resolve the country where an Ip comes from.

v1.0.1(10y ago)1484to killPHP

Since Dec 16Pushed 9y ago1 watchersCompare

[ Source](https://github.com/wakumaku/ip2c)[ Packagist](https://packagist.org/packages/wakumaku/ip2c)[ Docs](https://github.com/wakumaku/ip2c)[ RSS](/packages/wakumaku-ip2c/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

ip2c - Ip to Country PHP library
================================

[](#ip2c---ip-to-country-php-library)

[![Codacy Badge](https://camo.githubusercontent.com/c25226d4c9cbb4126e21b1cc73531dd94d27010fb6d93e1bb1138372c6035184/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6633623739353230643661323464636439393166633239346534356166663837)](https://www.codacy.com/app/wakumaku/ip2c?utm_source=github.com&utm_medium=referral&utm_content=wakumaku/ip2c&utm_campaign=badger)[![Build Status](https://camo.githubusercontent.com/f408f3e88627beecc533f12a1683853ed78b08ede0811dfa6a78e58bfd3e09a9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f77616b756d616b752f697032632f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/wakumaku/ip2c/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/1cc412e68f69aef9830418b07262220bf365f57861a5149be673207694ccedf1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f77616b756d616b752f697032632f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/wakumaku/ip2c/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7c57c1731b6de4bf8a97d414d06ff24471083aecd0b53d6f621d30d7240919e7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f77616b756d616b752f697032632f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/wakumaku/ip2c/?branch=master)

Ip2c is a small php library to retrieve the country where an Ip comes from.

This library uses  as a service.

Installation
------------

[](#installation)

### Prerequisites

[](#prerequisites)

Ip2c requires PHP 5.3.3 or greater.

If you want to run the tests you'll need a greater one (&gt;=5.5)

### Setup through composer

[](#setup-through-composer)

First, add Ip2c to the list of dependencies inside your `composer.json`:

```
{
    "require": {
        "wakumaku/ip2c": "dev-master"
    }
}
```

Composer update:

```
$> composer update
```

How to use it
-------------

[](#how-to-use-it)

```
include vendor/autoload.php';

$ip2c = \Ip2c\Ip2cFactory::build();

$result = $ip2c->self();

echo "Status: " . $result->status() . "\n";
echo "Iso2: " . $result->iso2() . "\n";
echo "Iso3: " . $result->iso3() . "\n";
echo "Name: " . $result->name() . "\n";
```

Output:

```
    Status: 1
    Iso2: ES
    Iso3: ESP
    Name: Spain

```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 97.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~125 days

Total

2

Last Release

3724d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/938022?v=4)[wakumaku](/maintainers/wakumaku)[@wakumaku](https://github.com/wakumaku)

---

Top Contributors

[![wakumaku](https://avatars.githubusercontent.com/u/938022?v=4)](https://github.com/wakumaku "wakumaku (36 commits)")[![codacy-badger](https://avatars.githubusercontent.com/u/23704769?v=4)](https://github.com/codacy-badger "codacy-badger (1 commits)")

---

Tags

maxminddnsIPwhoiscountryip to countryip2c

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wakumaku-ip2c/health.svg)

```
[![Health](https://phpackages.com/badges/wakumaku-ip2c/health.svg)](https://phpackages.com/packages/wakumaku-ip2c)
```

###  Alternatives

[daverandom/libdns

DNS protocol implementation written in pure PHP

16443.9M13](/packages/daverandom-libdns)[kartik-v/yii2-ipinfo

An IP address information display widget for Yii 2.0 with country flag and geo position info.

2733.3k1](/packages/kartik-v-yii2-ipinfo)[hibit-dev/geodetect

Automatically detect user's geo data based on their IP address

2321.5k](/packages/hibit-dev-geodetect)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
