PHPackages                             victorybiz/geoip-location - 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. victorybiz/geoip-location

ActiveLibrary

victorybiz/geoip-location
=========================

Get the geographical location of website visitors based on their IP addresses. Support Laravel and PHP (Non-Laravel) Project.

v1.1.10(4y ago)22157.9k—6.4%4[1 issues](https://github.com/victorybiz/geoip-location/issues)2MITPHPPHP &gt;=7.2

Since Aug 1Pushed 4y ago1 watchersCompare

[ Source](https://github.com/victorybiz/geoip-location)[ Packagist](https://packagist.org/packages/victorybiz/geoip-location)[ Patreon](https://www.patreon.com/victoryosayi)[ RSS](/packages/victorybiz-geoip-location/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (17)Used By (2)

GeoIP Location
==============

[](#geoip-location)

[![GitHub release](https://camo.githubusercontent.com/398cd2543247c0bac005a5f51e0d7583acc61c586caf72e88a65db6814b2f4ed/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f766963746f727962697a2f67656f69702d6c6f636174696f6e2e737667)](https://packagist.org/packages/victorybiz/geoip-location)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)[![Build Status](https://camo.githubusercontent.com/0b7a8020d74bcf408c5d5e502501ec38fd850d1f4c6fc893b7cd2043071c76e7/68747470733a2f2f7472617669732d63692e6f72672f766963746f727962697a2f67656f69702d6c6f636174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/victorybiz/geoip-location)[![Packagist](https://camo.githubusercontent.com/8836c4c331dfa676ba5c79b8a5da22c425ccafc885334607df03000b8dfb39dd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f766963746f727962697a2f67656f69702d6c6f636174696f6e2e737667)](https://packagist.org/packages/victorybiz/geoip-location)

Get the geographical location of website visitors based on their IP addresses. Support Laravel and PHP (Non-Laravel) Project.

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

[](#installation)

Install using composer, from the command line run:

```
$ composer require victorybiz/geoip-location
```

### Laravel Project

[](#laravel-project)

Alternatively, you can add `"victorybiz/geoip-location": "^1.1"` to your composer.json file's `require` section and then you'll then need to run `composer install` or `composer update` to download it and have the autoloader updated.

> If you use **Laravel &gt;= 5.5** you can skip this step and go to [**`usage`**](https://github.com/victorybiz/geoip-location#usage-in-laravel-project)

> If you use **Laravel &lt; 5.5**, you need to register the service provider with the application. Open up `config/app.php` and locate the `providers` key.

```
'providers' => [

    Victorybiz\GeoIPLocation\GeoIPLocationServiceProvider::class,

]
```

And add the GeoIPLocation alias to config/app.php:

```
'aliases' => [

	'GeoIPLocation' => Victorybiz\GeoIPLocation\Facades\GeoIPLocationFacade::class,

]
```

### Usage in Laravel Project

[](#usage-in-laravel-project)

Please use the `GeoIPLocation` Facade

```
use GeoIPLocation;

echo GeoIPLocation::getIP(); // Return client IP
```

### PHP (Non-Laravel) Project

[](#php-non-laravel-project)

Require the vendor autoload file in your php script.

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

Usage
-----

[](#usage)

Localhost IP `127.0.0.1`, `192.168.65.0`, `172.18.0.1` and `::1` will return `169.159.82.111` to assert a valid geo response.

```
    use Victorybiz\GeoIPLocation\GeoIPLocation;

    $geoip = new GeoIPLocation();

    // OR

    $geoip = new GeoIPLocation([
        'ip' => null, // Set IP.  Default is NULL, will be auto set by the package
        'baseCurrency' => 'USD', // Set base currency for exchange rate. Default is USD
    ]);
```

Alternatively

```
    $geoip = new \Victorybiz\GeoIPLocation\GeoIPLocation();

    // OR

    $geoip = new \Victorybiz\GeoIPLocation\GeoIPLocation([
        'ip' => null, // Set IP.  Default is NULL, will be auto set by the package
        'baseCurrency' => 'USD', // Set base currency for exchange rate. Default is USD
    ]);
```

You're good to go, explore the package

```
    echo $geoip->getIP(); // Return client IP

    echo $geoip->setIP('0.0.0.0'); // Set an IP to get its geographical location

    echo $geoip->getCity(); // Return client IP City (null if none)

    echo $geoip->getRegion(); // Return client IP Region (null if none)

    echo $geoip->getRegionCode(); // Return client IP Region Code (null if none)

    echo $geoip->getCountry(); // Return client IP Country

    echo $geoip->getCountryCode(); // Return client IP Country Code

    echo $geoip->getContinent(); // Return client IP Continent

    echo $geoip->getContinentCode(); // Return client IP Continent Code

    echo $geoip->getPostalCode(); // Return client IP Postal Code (null if none)

    echo $geoip->getLatitude(); // Return client IP Latitude (null if none)

    echo $geoip->getLongitude(); // Return client IP Longitude (null if none)

    echo $geoip->getCurrencyCode(); // Return client IP Country Currency Code (null if none)

    echo $geoip->getCurrencySymbol(); // Return client IP Country Currency Symbol (null if none)

    echo $geoip->getCurrencyExchangeRate(); // Return client IP Country Currency Exchange Rate against NGN (null if none)

    echo $geoip->getLocation(); // Return client IP Location string (city, region, country)
```

Web Services
------------

[](#web-services)

- **geoPlugin** - GeoIP Location wrap around geolocation web service from [geoPlugin](http://www.geoplugin.com/). Don't hesitate to checkout [Premium geoPlugin access](http://www.geoplugin.com/premium).

Bug Reports and Issue tracking
------------------------------

[](#bug-reports-and-issue-tracking)

Kindly make use of the issue tracker for bug reports, feature request, additional web service request and security issues.

License
-------

[](#license)

[MIT](http://opensource.org/licenses/MIT)

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity43

Moderate usage in the ecosystem

Community13

Small or concentrated contributor base

Maturity66

Established project with proven stability

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

Recently: every ~73 days

Total

16

Last Release

1601d ago

Major Versions

v0.1.1 → v1.0.02017-08-02

PHP version history (3 changes)v0.1.0PHP &gt;=5.6.4

v0.1.1PHP &gt;=5.6

v1.1.2PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/10cf31ece5d47446da1fde10df50e84c0d2bbd0052f0f688e89590d9b8909f5a?d=identicon)[victorybiz](/maintainers/victorybiz)

---

Top Contributors

[![victorybiz](https://avatars.githubusercontent.com/u/8276466?v=4)](https://github.com/victorybiz "victorybiz (60 commits)")

---

Tags

geoip-locationgeopluginlaravelphpwebsite-visitorsphplaravelgeoiplaravel 6laravel 7laravel 8githublaravel 5open-source

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/victorybiz-geoip-location/health.svg)

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

###  Alternatives

[unicodeveloper/laravel-paystack

A Laravel Package for Paystack

650975.6k11](/packages/unicodeveloper-laravel-paystack)[prevailexcel/laravel-nowpayments

A Laravel Package for NOWPayments

1414.2k](/packages/prevailexcel-laravel-nowpayments)[thepeer/sdk

Thepeer official Laravel SDK

272.8k](/packages/thepeer-sdk)

PHPackages © 2026

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