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

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

ip2location/ip2location-laravel
===============================

Lookup for visitor's IP information, such as country, region, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code, weather, MCC, MNC, mobile brand name, elevation and usage type.

1.3.3(7mo ago)82548.8k↓47.6%151MITPHPPHP &gt;=5.4

Since Jan 25Pushed 6mo ago7 watchersCompare

[ Source](https://github.com/ip2location/ip2location-laravel)[ Packagist](https://packagist.org/packages/ip2location/ip2location-laravel)[ RSS](/packages/ip2location-ip2location-laravel/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (1)Versions (11)Used By (1)

IP2Location Laravel Extension
=============================

[](#ip2location-laravel-extension)

[![Latest Stable Version](https://camo.githubusercontent.com/5e39b4cb4c9872fb1b05cf56ce8826645e64dcb3bafb1051c9ab06a2efc204a4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6970326c6f636174696f6e2f6970326c6f636174696f6e2d6c61726176656c2e737667)](https://packagist.org/packages/ip2location/ip2location-laravel)[![Total Downloads](https://camo.githubusercontent.com/7ea9f5f8ea84fc11c303668d8d4c77664e3d5c3a63cde1ed940570da0ee4b6d9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6970326c6f636174696f6e2f6970326c6f636174696f6e2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ip2location/ip2location-laravel)

IP2Location Laravel extension enables the user to find the country, region, district, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code, weather, MCC, MNC, mobile brand name, elevation, usage type, IP address type, IAB advertising category and ASN from IP address using IP2Location database. It has been optimized for speed and memory utilization.

*Note: This extension works in Laravel 6, Laravel 7, Laravel 8, Laravel 9, Laravel 10, Laravel 11 and Laravel 12.*

INSTALLATION
------------

[](#installation)

Run the command: `composer require ip2location/ip2location-laravel` to download the package into the Laravel platform.

USAGE
-----

[](#usage)

IP2Location Laravel extension is able to query the IP address information from either BIN database or web service. This section will explain how to use this extension to query from BIN database and web service.

### BIN DATABASE

[](#bin-database)

1. Download IP2Location BIN database
    - IP2Location free LITE database at
    - IP2Location commercial database at
2. To use IP2Location databases, create a folder named as `ip2location` in the `database` directory.
3. Unzip and copy the BIN file into `database/ip2location/` folder.
4. Rename the BIN file to IP2LOCATION.BIN.
5. Create a **TestController** in Laravel using the below command line

```
php artisan make:controller TestController

```

6. Open the **app/Http/Controllers/TestController.php** in any text editor.
7. To use IP2Location databases, add the below lines into the controller file.

```
