PHPackages                             webklex/php-geoip - 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. webklex/php-geoip

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

webklex/php-geoip
=================

PHP GeoIP client

1.0.0(5y ago)39421MITPHPPHP &gt;=5.5.9

Since Oct 17Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Webklex/php-geoip)[ Packagist](https://packagist.org/packages/webklex/php-geoip)[ Docs](https://github.com/webklex/php-geoip)[ RSS](/packages/webklex-php-geoip/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (1)

GeoIP Library for PHP
=====================

[](#geoip-library-for-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7592ca3217010acf9c3c8d80c9ba40b4a47a136ea9e7442e0f20e97c3c1c0ed0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f5765626b6c65782f7068702d67656f69702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Webklex/php-geoip)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/Webklex/php-geoip/blob/master/LICENSE)[![Build Status](https://camo.githubusercontent.com/979f06322c951358df9ba593d02ac186ba345ef5c78df86d9c126b7a6a84e272/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f6275696c642f672f5765626b6c65782f7068702d67656f69702f6d61737465723f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Webklex/php-geoip/code-structure)[![Total Downloads](https://camo.githubusercontent.com/fd57b14285ed061ca75c9d8db7bb16c2da0bfcf1c36abef45640ca552e68d73b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f5765626b6c65782f7068702d67656f69702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Webklex/php-geoip)[![Hits](https://camo.githubusercontent.com/d83ee54059329226aa8678d8de36456bc968223373b4b8006cbb23f382baba77/68747470733a2f2f686974732e7765626b6c65782e636f6d2f7376672f7765626b6c65782f7068702d67656f6970)](https://hits.webklex.com)

Description
-----------

[](#description)

PHP-GeoIP provides you with the ability to gather open source ip intelligence by using the open api provided by [GoGeoIP](https://github.com/Webklex/gogeoip).

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
    - [Basic usage example](#basic-usage-example)
- [Support](#support)
- [Security](#security)
- [Credits](#credits)
- [License](#license)

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

[](#installation)

1.) Just install the PHP-GeoIP package by running the following command:

```
composer require webklex/php-geoip
```

Usage
-----

[](#usage)

#### Basic usage example

[](#basic-usage-example)

This is a basic example, which will dump the geoip information for the current user ip as well as for the ip "205.13.135.36".

```
use Webklex\GeoIP\GeoIP;

$gp = new GeoIP();

var_dump($gp->current());
var_dump($gp->get("205.13.135.36"));
```

If you want to use your own instance of [GoGeoIP](https://github.com/Webklex/gogeoip), just provide your endpoint instead:

```
use Webklex\GeoIP\GeoIP;

$gp = new GeoIP("https://my_enpoint.tld");

var_dump($gp->current());
var_dump($gp->get("205.13.135.36"));
```

#### Response:

[](#response)

```
{
  "network": {
    "ip": "208.13.138.36",
    "as": {
      "number": 209,
      "name": "CenturyLink Communications, LLC"
    },
    "isp": "",
    "domain": "",
    "tld": [".us"],
    "bot": false,
    "tor": false,
    "proxy": false,
    "proxy_type": "",
    "last_seen": 0,
    "usage_type": ""
  },
  "location": {
    "region_code": "NV",
    "region_name": "",
    "city": "Las Vegas",
    "zip_code": "89129",
    "time_zone": "America/Los_Angeles",
    "longitude": -115.2821,
    "latitude": 36.2473,
    "accuracy_radius": 20,
    "metro_code": 839,
    "country": {
      "code": "US",
      "cioc": "USA",
      "ccn3": "840",
      "call_code": ["1"],
      "international_prefix": "011",
      "capital": "Washington D.C.",
      "name": "United States",
      "full_name": "United States of America",
      "area": 9372610,
      "borders": ["CAN", "MEX"],
      "latitude": 39.443256,
      "longitude": -98.95734,
      "max_latitude": 71.441055,
      "max_longitude": -66.885414,
      "min_latitude": 17.831509,
      "min_longitude": -179.23108,
      "currency": [{
          "code": "USD",
          "name": ""
       }, {
          "code": "USN",
          "name": ""
       }, {
          "code": "USS",
          "name": ""
      }],
      "continent": {
        "code": "",
        "name": "North America",
        "sub_region": ""
      }
    }
  }
}
```

Support
-------

[](#support)

If you encounter any problems or if you find a bug, please don't hesitate to create a new [issue](https://github.com/Webklex/php-geoip/issues). However please be aware that it might take some time to get an answer. Off topic, rude or abusive issues will be deleted without any notice.

If you need **immediate** or **commercial** support, feel free to send me a mail at .

##### A little notice

[](#a-little-notice)

If you write source code in your issue, please consider to format it correctly. This makes it so much nicer to read and people are more likely to comment and help :)

``` php

echo 'your php code...';

```

will turn into:

```
echo 'your php code...';
```

### Features &amp; pull requests

[](#features--pull-requests)

Everyone can contribute to this project. Every pull request will be considered but it can also happen to be declined. To prevent unnecessary work, please consider to create a [feature issue](https://github.com/Webklex/php-geoip/issues/new?template=feature_request.md)first, if you're planning to do bigger changes. Of course you can also create a new [feature issue](https://github.com/Webklex/php-geoip/issues/new?template=feature_request.md)if you're just wishing a feature ;)

Change log
----------

[](#change-log)

Please see [CHANGELOG](https://github.com/Webklex/php-geoip/blob/master/CHANGELOG.md) for more information what has changed recently.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Webklex](https://github.com/webklex)
- [All Contributors](https://github.com/Webklex/php-geoip/graphs/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/Webklex/php-geoip/blob/master/LICENSE) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

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

2

Last Release

2039d ago

Major Versions

0.0.1 → 1.0.02020-10-17

### Community

Maintainers

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

---

Top Contributors

[![Webklex](https://avatars.githubusercontent.com/u/2884144?v=4)](https://github.com/Webklex "Webklex (5 commits)")

---

Tags

geoipIPwebklexphp-geoip

### Embed Badge

![Health badge](/badges/webklex-php-geoip/health.svg)

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

###  Alternatives

[stevebauman/location

Retrieve a user's location by their IP Address

1.3k7.6M65](/packages/stevebauman-location)[torann/geoip

Support for multiple Geographical Location services.

2.2k14.2M76](/packages/torann-geoip)[willdurand/geocoder

Common files for PHP Geocoder

17435.7M159](/packages/willdurand-geocoder)[s1lentium/iptools

PHP Library for manipulating network addresses (IPv4 and IPv6)

2446.2M24](/packages/s1lentium-iptools)[ipip/db

IPIP.net officially supported IP database ipdb format parsing library

139204.2k6](/packages/ipip-db)[rlanvin/php-ip

IPv4/IPv6 manipulation library for PHP

180738.8k11](/packages/rlanvin-php-ip)

PHPackages © 2026

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