IP2Location is a 3rd party provider which provides website owners the option to detect the actual location of the visitor i.e. country, city, postcode, ISP etc from the IP address of the visitor. They provide you several options to use their data to detect the visitor’s location.
For this example I will use the option of downloading a BIN file from their website and use it in my Laravel website. The integration process is quite straight forward and easy as well.
- First run the command:
composer require ip2location/ip2location-laravel
to download the package into the Laravel platform.
config/app.phpand add this line in ‘providers’ section:
- Publish the config file by:
php artisan vendor:publish --provider=Ip2locationIP2LocationLaravelIP2LocationLaravelServiceProvider --force
- Create a folder named as
- Copy the IPV6-COUNTRY.BIN file into
- Rename the BIN file to IP2LOCATION.BIN
Hope the above helped you.