PHPackages                             guibranco/ipquery-php - 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. guibranco/ipquery-php

ActiveLibrary[API Development](/categories/api)

guibranco/ipquery-php
=====================

A lightweight and efficient PHP library for querying IP data from the IpQuery API.

v1.1.67(2mo ago)144MITPHPPHP &gt;=8.2CI passing

Since Dec 25Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/guibranco/ipquery-php)[ Packagist](https://packagist.org/packages/guibranco/ipquery-php)[ RSS](/packages/guibranco-ipquery-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (74)Used By (0)

🌐📍 IpQuery API Client for PHP
=============================

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

A lightweight and efficient PHP library for querying IP data from the [IpQuery API](https://ipquery.io/).
Easily retrieve detailed information about IP addresses, including ISP details, geolocation, and risk analysis.

[![Packagist Downloads](https://camo.githubusercontent.com/d8bd75af70d2062c94084427af7e0b9a40eba17b70bffc1843fc8e967f3b39a2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6775696272616e636f2f697071756572792d706870)](https://packagist.org/packages/guibranco/ipquery-php)[![GitHub Downloads](https://camo.githubusercontent.com/4313de3cd8e0bea79a4a40a1b0189a8976393f718e07907949cc600b777e63b4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f6775696272616e636f2f697071756572792d7068702f746f74616c)](https://github.com/guibranco/ipquery-php/releases)

---

Features ✨
----------

[](#features-)

- Retrieve your public IP information with ease.
- Query detailed data for single or multiple IP addresses.
- Parse JSON responses into strongly-typed PHP objects.
- Simple integration using pure PHP and cURL.

---

Installation 📦
--------------

[](#installation-)

You can install the library using Composer:

```
composer require guibranco/ipquery-php
```

---

Usage 🚀
-------

[](#usage-)

### Get your public IP data

[](#get-your-public-ip-data)

```
require_once 'vendor/autoload.php';

use GuiBranco\IpQuery\IpQueryClient;

$client = new IpQueryClient();

try {
    $ipQuery = $client->getMyIpData();
    echo "My IP: {$ipQuery->ip}" . PHP_EOL;
    echo "ISP: {$ipQuery->isp->org}" . PHP_EOL;
} catch (Exception $e) {
    echo "Error: " . $e->getMessage() . PHP_EOL;
}
```

### Get data for a specific IP

[](#get-data-for-a-specific-ip)

```
$ipData = $client->getIpData('8.8.8.8');
echo "IP: {$ipData->ip}" . PHP_EOL;
echo "Location: {$ipData->location->city}, {$ipData->location->country}" . PHP_EOL;
```

### Get data for multiple IPs

[](#get-data-for-multiple-ips)

```
$multipleIpData = $client->getMultipleIpData(['8.8.8.8', '8.8.4.4']);
foreach ($multipleIpData as $ip) {
    echo "IP: {$ip->ip}, Org: {$ip->isp->org}" . PHP_EOL;
}
```

---

Response Mapping 🗺️
-------------------

[](#response-mapping-️)

The library parses JSON responses into the following class structure:

### IpQueryResponse

[](#ipqueryresponse)

```
class IpQueryResponse {
    public string $ip;
    public Isp $isp;
    public Location $location;
    public Risk $risk;
}
```

### Isp

[](#isp)

```
class Isp {
    public string $asn;
    public string $org;
    public string $isp;
}
```

### Location

[](#location)

```
class Location {
    public string $country;
    public string $country_code;
    public string $city;
    public string $state;
    public string $zipcode;
    public float $latitude;
    public float $longitude;
    public string $timezone;
    public string $localtime;
}
```

### Risk

[](#risk)

```
class Risk {
    public bool $is_mobile;
    public bool $is_vpn;
    public bool $is_tor;
    public bool $is_proxy;
    public bool $is_datacenter;
    public int $risk_score;
}
```

---

Requirements 🛠️
---------------

[](#requirements-️)

- PHP 8.2 or newer
- cURL extension enabled

---

Running Tests 🧪
---------------

[](#running-tests-)

This project uses [PhpUnit 11](https://phpunit.de/) for unit tests. To run the tests, execute:

```
./vendor/bin/phpunit
```

---

Contribution 🤝
--------------

[](#contribution-)

Contributions are welcome! Please read the [CONTRIBUTING.md](https://github.com/guibranco/ipquery-php/blob/main/CONTRIBUTING.md) file for details on the process.
Feel free to open issues or submit pull requests to improve the library.

---

License 📜
---------

[](#license-)

This project is licensed under the [MIT License](LICENSE).

---

Examples 📚
----------

[](#examples-)

Explore the [examples/](https://github.com/guibranco/ipquery-php/tree/main/examples/) directory for more code samples and ideas.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance86

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~6 days

Recently: every ~23 days

Total

72

Last Release

66d ago

Major Versions

v0.1.9 → v1.0.02024-12-25

PHP version history (2 changes)v0.1.5PHP &gt;=7.4

v1.1.0PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/bdca6352c610406a2b1c83dfe4affa6e2fef97114ce98d39305358a436e87562?d=identicon)[guistracini](/maintainers/guistracini)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (37 commits)")[![depfu[bot]](https://avatars.githubusercontent.com/in/715?v=4)](https://github.com/depfu[bot] "depfu[bot] (34 commits)")[![guibranco](https://avatars.githubusercontent.com/u/3362854?v=4)](https://github.com/guibranco "guibranco (12 commits)")[![gitauto-ai[bot]](https://avatars.githubusercontent.com/in/844909?v=4)](https://github.com/gitauto-ai[bot] "gitauto-ai[bot] (1 commits)")[![penify-dev[bot]](https://avatars.githubusercontent.com/in/399279?v=4)](https://github.com/penify-dev[bot] "penify-dev[bot] (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/guibranco-ipquery-php/health.svg)

```
[![Health](https://phpackages.com/badges/guibranco-ipquery-php/health.svg)](https://phpackages.com/packages/guibranco-ipquery-php)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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