PHPackages                             ipdata/api-client - 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. [API Development](/categories/api)
4. /
5. ipdata/api-client

ActiveLibrary[API Development](/categories/api)

ipdata/api-client
=================

API client for ipdata.co

0.1.2(5mo ago)18101.4k↓46.5%4[1 PRs](https://github.com/ipdata/php/pulls)1MITPHPPHP &gt;= 7.2CI failing

Since Jan 29Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/ipdata/php)[ Packagist](https://packagist.org/packages/ipdata/api-client)[ RSS](/packages/ipdata-api-client/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (3)Dependencies (6)Versions (6)Used By (1)

Ipdata.co API client for PHP
============================

[](#ipdataco-api-client-for-php)

An API client to communicate with Ipdata.co.

Install
-------

[](#install)

```
composer require ipdata/api-client

```

The client is built upon PSR standards. We use PSR-18 for HTTP client and PSR-17 for RequestFactory. These needs to be passed to the client's constructor.

Example packages for PSR-17 and PSR-18:

```
composer require nyholm/psr7 symfony/http-client

```

```
use Ipdata\ApiClient\Ipdata;
use Symfony\Component\HttpClient\Psr18Client;
use Nyholm\Psr7\Factory\Psr17Factory;

$httpClient = new Psr18Client();
$psr17Factory = new Psr17Factory();
$ipdata = new Ipdata('my_api_key', $httpClient, $psr17Factory);
```

### EU endpoint

[](#eu-endpoint)

To route requests through ipdata's EU servers (Paris, Ireland and Frankfurt) for GDPR compliance, pass the EU base URL:

```
$ipdata = new Ipdata('my_api_key', $httpClient, $psr17Factory, Ipdata::EU_BASE_URL);
```

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

[](#how-to-use)

### Look up your own IP

[](#look-up-your-own-ip)

Call `lookup()` with no arguments to get the location of the calling IP address.

```
$data = $ipdata->lookup();
```

### Look up a specific IP

[](#look-up-a-specific-ip)

To send a geocode request you simply need to provide the IP address you are interested in.

```
$data = $ipdata->lookup('69.78.70.144');
echo json_encode($data, JSON_PRETTY_PRINT);
```

The output will be the response from the API server with one additional `status` field.

```
{
    "ip": "69.78.70.144",
    "is_eu": false,
    "city": null,
    "region": null,
    "region_code": null,
    "country_name": "United States",
    "country_code": "US",
    "continent_name": "North America",
    "continent_code": "NA",
    "latitude": 37.751,
    "longitude": -97.822,
    "postal": null,
    "calling_code": "1",
    "flag": "https:\/\/ipdata.co\/flags\/us.png",
    "emoji_flag": "\ud83c\uddfa\ud83c\uddf8",
    "emoji_unicode": "U+1F1FA U+1F1F8",
    "company": {
        "name": "Verizon Wireless",
        "domain": "verizonwireless.com",
        "network": "69.78.0.0\/16",
        "type": "isp"
    },
    "asn": {
        "asn": "AS6167",
        "name": "Cellco Partnership DBA Verizon Wireless",
        "domain": "verizonwireless.com",
        "route": "69.78.0.0\/16",
        "type": "business"
    },
    "carrier": {
        "name": "Verizon",
        "mcc": "310",
        "mnc": "004"
    },
    "languages": [
        {
            "name": "English",
            "native": "English"
        }
    ],
    "currency": {
        "name": "US Dollar",
        "code": "USD",
        "symbol": "$",
        "native": "$",
        "plural": "US dollars"
    },
    "time_zone": {
        "name": "America\/Chicago",
        "abbr": "CST",
        "offset": "-0600",
        "is_dst": false,
        "current_time": "2020-01-25T06:14:37.081772-06:00"
    },
    "threat": {
        "is_tor": false,
        "is_vpn": false,
        "is_icloud_relay": false,
        "is_proxy": false,
        "is_datacenter": false,
        "is_anonymous": false,
        "is_known_attacker": false,
        "is_known_abuser": false,
        "is_threat": false,
        "is_bogon": false,
        "blocklists": [],
        "scores": {
            "vpn_score": 0,
            "proxy_score": 0,
            "threat_score": 0,
            "trust_score": 0
        }
    },
    "count": "6",
    "status": 200
}
```

If you are not interested in all the fields in the response, you may query only the fields you want.

```
$data = $ipdata->lookup('69.78.70.144', ['longitude', 'latitude', 'country_name']);
echo json_encode($data, JSON_PRETTY_PRINT);
```

```
{
    "longitude": -97.822,
    "latitude": 37.751,
    "country_name": "United States",
    "status": 200
}
```

### Bulk request

[](#bulk-request)

If you want to look up multiple IPs at the same time you may use the `bulkLookup()` function.

```
$data = $ipdata->bulkLookup(['1.1.1.1', '69.78.70.144'], ['longitude', 'latitude', 'country_name']);
echo json_encode($data, JSON_PRETTY_PRINT);
```

```
{
    "0": {
        "longitude": 143.2104,
        "latitude": -33.494,
        "country_name": "Australia"
    },
    "1": {
        "longitude": -97.822,
        "latitude": 37.751,
        "country_name": "United States"
    },
    "status": 200
}
```

Available Fields
----------------

[](#available-fields)

A list of all the fields returned by the API is maintained at [Response Fields](https://docs.ipdata.co/api-reference/response-fields)

Errors
------

[](#errors)

A list of possible errors is available at [Status Codes](https://docs.ipdata.co/api-reference/status-codes)

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance77

Regular maintenance activity

Popularity41

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 69.2% 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 ~1109 days

Total

3

Last Release

175d ago

PHP version history (2 changes)0.1.0PHP ^7.2

0.1.1PHP &gt;= 7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/401ccc5eea13c60cf807ae982af00e368e2166e2f26d8eb541dcd881a57385bc?d=identicon)[Nyholm](/maintainers/Nyholm)

![](https://www.gravatar.com/avatar/c16c3a03895fb02383416a6bd4361fe60ae2a94db6cbca384a78ee889d9a1337?d=identicon)[jonathan-kosgei](/maintainers/jonathan-kosgei)

---

Top Contributors

[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (9 commits)")[![claude](https://avatars.githubusercontent.com/u/81847?v=4)](https://github.com/claude "claude (2 commits)")[![jonathan-kosgei](https://avatars.githubusercontent.com/u/6712914?v=4)](https://github.com/jonathan-kosgei "jonathan-kosgei (2 commits)")

---

Tags

geolocationipdata

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ipdata-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/ipdata-api-client/health.svg)](https://phpackages.com/packages/ipdata-api-client)
```

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k21](/packages/tempest-framework)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

86337.5k](/packages/flow-php-flow)[getbrevo/brevo-php

Official PHP SDK for the Brevo API.

1004.1M59](/packages/getbrevo-brevo-php)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6943.5M449](/packages/drupal-core-recommended)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

36826.2k2](/packages/telnyx-telnyx-php)[chargebee/chargebee-php

ChargeBee API client implementation for PHP

758.7M10](/packages/chargebee-chargebee-php)

PHPackages © 2026

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