PHPackages                             chrisullyott/php-ip-api - 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. chrisullyott/php-ip-api

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

chrisullyott/php-ip-api
=======================

A PHP wrapper for ip-api.com.

v1.0.1(5y ago)23932MITPHPPHP &gt;=5.4

Since Aug 11Pushed 5y ago1 watchersCompare

[ Source](https://github.com/chrisullyott/php-ip-api)[ Packagist](https://packagist.org/packages/chrisullyott/php-ip-api)[ Docs](https://github.com/chrisullyott/php-ip-api)[ RSS](/packages/chrisullyott-php-ip-api/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (5)Versions (8)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/97e257550bcd67d1e6c6387dd9ca4ccfc1c1c96dc354e88c2e23e2136cdbaf88/68747470733a2f2f706f7365722e707567782e6f72672f6368726973756c6c796f74742f7068702d69702d6170692f762f737461626c65)](https://packagist.org/packages/chrisullyott/php-ip-api)[![Total Downloads](https://camo.githubusercontent.com/a80df2aa15f72803215d02125671ecde408791fcc22f7b4d149776eefeebdbcb/68747470733a2f2f706f7365722e707567782e6f72672f6368726973756c6c796f74742f7068702d69702d6170692f646f776e6c6f616473)](https://packagist.org/packages/chrisullyott/php-ip-api)

PHP IP API
==========

[](#php-ip-api)

Fetch geolocation data for IP addresses from [ip-api.com](https://ip-api.com/).

### Installation

[](#installation)

```
$ composer require chrisullyott/php-ip-api
```

### Instantiation

[](#instantiation)

```
$api = new ChrisUllyott\IpApi();

// Set output language and fields (optional)
$api->setLanguage('en');
$api->setFields(['query', 'country', 'city']);
```

### Request one

[](#request-one)

```
$response = $api->get('91.198.174.192');
print_r($response);
```

```
stdClass Object
(
    [country] => Netherlands
    [city] => Amsterdam
    [query] => 91.198.174.192
)
```

### Request many

[](#request-many)

```
$ips = [
    '100.142.29.254',
    '100.142.39.218'
];

$response = $api->get($ips);
print_r($response);
```

```
Array
(
    [0] => stdClass Object
        (
            [country] => United States
            [city] => Chicago
            [query] => 100.142.29.254
        )

    [1] => stdClass Object
        (
            [country] => United States
            [city] => Chicago
            [query] => 100.142.39.218
        )
)
```

### Request from a file (create CSV)

[](#request-from-a-file-create-csv)

Using a newline-separated list of IP addresses, a CSV file of response data will be built.

```
$file = 'ips.txt';

$list = new ChrisUllyott\IpApiList($file);
$list->setFields(['query', 'country', 'city']);
$list->build();
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

7

Last Release

2102d ago

Major Versions

v0.3.0 → v1.0.02020-08-15

PHP version history (2 changes)v0.0.1PHP &gt;=7.1.0

v1.0.0PHP &gt;=5.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/6bbd75614cbb5b6d8c4e21a6564cb67f3d403532be5c02859f1078c087a35f74?d=identicon)[chrisullyott](/maintainers/chrisullyott)

---

Top Contributors

[![chrisullyott](https://avatars.githubusercontent.com/u/1007459?v=4)](https://github.com/chrisullyott "chrisullyott (21 commits)")

---

Tags

ip-addressip-geolocationphpphpip geolocationip-address

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/chrisullyott-php-ip-api/health.svg)

```
[![Health](https://phpackages.com/badges/chrisullyott-php-ip-api/health.svg)](https://phpackages.com/packages/chrisullyott-php-ip-api)
```

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)[atchondjo/geoip2country

A lightweight but powerful IP address lookup database solution to determine visitors country

344.1k](/packages/atchondjo-geoip2country)

PHPackages © 2026

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