PHPackages                             lostlink/laravel-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. lostlink/laravel-geoip

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

lostlink/laravel-geoip
======================

Geoip Wrapper with Laravel Support

1.1.0(3y ago)161MITPHPPHP ^8.0 || ^8.1

Since Dec 8Pushed 3y ago1 watchersCompare

[ Source](https://github.com/lostlink/laravel-geoip)[ Packagist](https://packagist.org/packages/lostlink/laravel-geoip)[ Docs](https://github.com/lostlink/laravel-geoip)[ RSS](/packages/lostlink-laravel-geoip/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (7)Versions (4)Used By (0)

GeoIP
=====

[](#geoip)

> Geoip Wrapper with Laravel Support

[![Latest Stable Version](https://camo.githubusercontent.com/aaacbd55c55919988bd212598e330185a67c5c043ff3464f43663848a0ef8541/687474703a2f2f706f7365722e707567782e6f72672f6c6f73746c696e6b2f6c61726176656c2d67656f69702f76)](https://packagist.org/packages/lostlink/laravel-geoip)[![MIT License](https://camo.githubusercontent.com/30597ff9a350144f03bffdd9183e16468e0b3ca1193e1d08591d992622738d55/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](http://www.opensource.org/licenses/MIT)[![Run Tests](https://github.com/lostlink/laravel-geoip/workflows/Run%20Tests/badge.svg?branch=main)](https://github.com/lostlink/laravel-geoip/workflows/Run%20Tests/badge.svg?branch=main)[![Coverage](https://camo.githubusercontent.com/afeba3b26ef3edae4ebe75e8e9d9958b60e8ebc637d235cfd1d82e71f20ee1aa/68747470733a2f2f636f6465636f762e696f2f67682f6c6f73746c696e6b2f6c61726176656c2d67656f69702f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d61477345673239314b68)](https://codecov.io/gh/lostlink/laravel-geoip)[![StyleCI](https://camo.githubusercontent.com/2d9ac7062f169a69b70d6595f1c0e56ed318aa697d8ca0a8ef078e1391256c24/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3433363337313334362f736869656c643f6272616e63683d6d61696e)](https://github.styleci.io/repos/436371346?branch=main)[![Total Downloads](https://camo.githubusercontent.com/f4480d840707152deff821c042809aad57e5dfae1806679e4167533c1ee469fd/687474703a2f2f706f7365722e707567782e6f72672f6c6f73746c696e6b2f6c61726176656c2d67656f69702f646f776e6c6f616473)](https://packagist.org/packages/lostlink/laravel-geoip)

Supported Drivers ([Services](#services))
-----------------------------------------

[](#supported-drivers-services)

- [IPStack](https://ipstack.com/)
- [IP-API](http://ip-api.com/)
- [Maxmind](https://www.maxmind.com/)
- [Telize](https://market.mashape.com/fcambus/telize/)

Requirements
------------

[](#requirements)

- PHP &gt;= 7.2

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

[](#installation)

Install via composer

```
composer require lostlink/laravel-geoip
```

### Laravel

[](#laravel)

There is a Laravel service provider and facade available.

Add the following to the `providers` array in your `config/app.php`

```
LostLink\GeoIP\GeoIPServiceProvider::class
```

Next add the following to the `aliases` array in your `config/app.php`

```
'GeoIP' => LostLink\GeoIP\Facades\GeoIP::class
```

Next run `php artisan vendor:publish --provider="LostLink\GeoIP\GeoIPServiceProvider" --tag="config"` to publish the config file.

#### Using an older version of PHP / Laravel?

[](#using-an-older-version-of-php--laravel)

If you are on a PHP version below 7.2 or a Laravel version below 5.8 just use an older version of this package.

Usage
-----

[](#usage)

The geoip class takes a config array as the first parameter or defaults to using the `ip-api` driver.

Example:

```
