PHPackages                             evinkuraga/geolocation - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. evinkuraga/geolocation

ActiveLibrary[HTTP &amp; Networking](/categories/http)

evinkuraga/geolocation
======================

A laravel package to hook into IP Info DB Service

v2.0.1(5y ago)012MITPHPPHP &gt;=5.5.9

Since Oct 15Pushed 5y agoCompare

[ Source](https://github.com/evinkuraga/geolocation)[ Packagist](https://packagist.org/packages/evinkuraga/geolocation)[ RSS](/packages/evinkuraga-geolocation/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (13)Used By (0)

Geolocation [![Latest Stable Version](https://camo.githubusercontent.com/f4d222ef2314a94a1855a014a91fd408de4f3fb49fac3d857a39c824f46ca595/68747470733a2f2f706f7365722e707567782e6f72672f6576696e6b75726167612f67656f6c6f636174696f6e2f76657273696f6e)](https://packagist.org/packages/evinkuraga/geolocation) [![Total Downloads](https://camo.githubusercontent.com/05f04f4618fcbef9cc86d9d1af98dece2105f26d9c23f659f60906dd710f6cc7/68747470733a2f2f706f7365722e707567782e6f72672f6576696e6b75726167612f67656f6c6f636174696f6e2f646f776e6c6f616473)](https://packagist.org/packages/evinkuraga/geolocation) [![Latest Unstable Version](https://camo.githubusercontent.com/015d16950a786246e4ca1ad05ba9e342a8204fdbcd14a9cdf4ca011075ff8f9a/68747470733a2f2f706f7365722e707567782e6f72672f6576696e6b75726167612f67656f6c6f636174696f6e2f762f756e737461626c65)](https://packagist.org/packages/evinkuraga/geolocation) [![License](https://camo.githubusercontent.com/88d4577e7339d37dc626cf6be1b5210f24f5feb2c370fffcab25e0947ebd0c63/68747470733a2f2f706f7365722e707567782e6f72672f6576696e6b75726167612f67656f6c6f636174696f6e2f6c6963656e73652e737667)](https://packagist.org/packages/evinkuraga/geolocation) [![Build](https://camo.githubusercontent.com/9b200938d398d37f2d96488de22825fec7b2559c9e9dada92d3a9f70b0291d8c/68747470733a2f2f7472617669732d63692e6f72672f6576696e6b75726167612f67656f6c6f636174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/evinkuraga/geolocation) [![Coverage Status](https://camo.githubusercontent.com/9d3c323eeb86cabdfe3fd0e1d8c6ae23930eee2934560e2cf4a665eec7ccaf9b/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6576696e6b75726167612f67656f6c6f636174696f6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/evinkuraga/geolocation?branch=master)
===========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#geolocation------)

A IP Info DB integration for Laravel

Note
====

[](#note)

This was forked from evinkuraga/geolocation just so I could edit the composer file to accept guzzle ^7.0 which is required to work with later verisons of laravel 6.0. I've noticed the usage of Guzzle seems minimal, so I will either eventually tweak it to work with guzzle 7, or just add it in the composer and see what happens.

Installation
============

[](#installation)

This package requires PHP 5.6+, and includes a Laravel 5 Service Provider and Facade.

To install through composer include the package in your `composer.json`.

```
"evinkuraga/geolocation": "^2.0"

```

Run `composer install` or `composer update` to download the dependencies or you can run `composer require evinkuraga/geolocation`.

Refresh Autoloader
------------------

[](#refresh-autoloader)

At this point some users may need to run the command `composer dump-autoload`. Alternatively, you can run `php artisan optimize`which should include the dump-autoload command.

Laravel 5 Integration
---------------------

[](#laravel-5-integration)

To use the package with Laravel 5 firstly add the GeoLocation service provider to the list of service providers in `app/config/app.php`.

```
'providers' => [

  Evinkuraga\GeoLocation\GeoLocationServiceProvider::class

];

```

Add the `GeoLocation` facade to your aliases array.

```
'aliases' => [

  'GeoLocation' => Evinkuraga\GeoLocation\Facades\GeoLocation::class,

];

```

Publish the config and migration files using `php artisan vendor:publish --provider="Evinkuraga\GeoLocation\GeoLocationServiceProvider"`

Configuration File
==================

[](#configuration-file)

Once you have published the config files, you will find a `geolocation.php` file in the `config` folder. You should look through these settings and update these where necessary.

Env
===

[](#env)

You will need to add the following to your `.env` file and update these with your own settings

```
GEOLOCATION_API_KEY=
GEOLOCATION_CACHE=

```

Get your GeoLocation API Key
============================

[](#get-your-geolocation-api-key)

Before using this package you must get an API Key from IP Info DB. Please access  and after registering and confirming your email address your api key will be show. Please copy and set to your `.env` file on `GEOLOCATION_API_KEY` option.

Example Usage
=============

[](#example-usage)

```
use Evinkuraga\GeoLocation\Contracts\Services\GeoLocation;
use Illuminate\Http\Request;

public function index(GeoLocation $geo, Request $request)
{
    $ipLocation = $geo->getCity($request->ip());

    // if you do $geo->get($request->ip()), the default precision is now city

    // $ipLocation is an IpLocation Object

    echo $ipLocation->ipAddress; // e.g. 127.0.0.1

    echo $ipLocation->getAddressString(); // e.g. London, United Kingdom

    // the object has a toJson() and toArray() method on it
    // so you can die and dump an array.
    dd($ipLocation->toArray());

}

```

Methods on IpLocation
=====================

[](#methods-on-iplocation)

```
$ipLocation->getStatusCode(); // returns status code of request (e.g. 200)
$ipLocation->getStatusMessage(); // returns any status message to go with code
$ipLocation->getIpAddress(); // the geolocation IP requested
$ipLocation->getCountryCode(); // country code of the IP e.g. GB
$ipLocation->getCountryName(); // country name of the IP e.g. United Kingdom
$ipLocation->getRegionName(); // region name of the IP e.g. England
$ipLocation->getCityName(); // city name of the IP e.g. London
$ipLocation->getZipCode(); // postcode of the IP e.g. SE01 1AA
$ipLocation->getPostCode(); // postcode of the IP e.g. SE01 1AA
$ipLocation->getLatitude(); // latitude of the IP e.g. 53.4030
$ipLocation->getLongitude(); // longitude of the IP e.g. -1.201
$ipLocation->getTimeZone(); // timezone of the IP e.g.
$ipLocation->getAddressString(); // gets the city, region and country as a string
$ipLocation->toArray(); // returns object as an array
$ipLocation->toJson(); // returns object as a json object

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 78.4% 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 ~134 days

Recently: every ~46 days

Total

12

Last Release

2020d ago

Major Versions

v1.0.5 → v2.0.02020-04-26

v1.x-dev → v2.0.12020-10-27

### Community

Maintainers

![](https://www.gravatar.com/avatar/0895278d07590e28317ad2b90140840b84afe8151d102e8f199183be58c154f1?d=identicon)[evinkuraga](/maintainers/evinkuraga)

---

Top Contributors

[![midnite81](https://avatars.githubusercontent.com/u/254850?v=4)](https://github.com/midnite81 "midnite81 (29 commits)")[![evinkuraga](https://avatars.githubusercontent.com/u/8986719?v=4)](https://github.com/evinkuraga "evinkuraga (4 commits)")[![evertramos](https://avatars.githubusercontent.com/u/905951?v=4)](https://github.com/evertramos "evertramos (2 commits)")[![LasseRafn](https://avatars.githubusercontent.com/u/2689341?v=4)](https://github.com/LasseRafn "LasseRafn (1 commits)")[![mnabialek](https://avatars.githubusercontent.com/u/7656807?v=4)](https://github.com/mnabialek "mnabialek (1 commits)")

---

Tags

laravelsms

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/evinkuraga-geolocation/health.svg)

```
[![Health](https://phpackages.com/badges/evinkuraga-geolocation/health.svg)](https://phpackages.com/packages/evinkuraga-geolocation)
```

###  Alternatives

[georgeboot/laravel-echo-api-gateway

Use Laravel Echo with API Gateway Websockets

10435.5k](/packages/georgeboot-laravel-echo-api-gateway)[muhammadhuzaifa/telescope-guzzle-watcher

Telescope Guzzle Watcher provide a custom watcher for intercepting http requests made via guzzlehttp/guzzle php library. The package uses the on\_stats request option for extracting the request/response data. The watcher intercept and log the request into the Laravel Telescope HTTP Client Watcher.

98239.8k1](/packages/muhammadhuzaifa-telescope-guzzle-watcher)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[behamin/service-proxy

for proxy or sending requests to other services with useful utilities

102.2k](/packages/behamin-service-proxy)

PHPackages © 2026

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