Download the PHP package reefki/laravel-geoip without Composer
On this page you can find all versions of the php package reefki/laravel-geoip. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download reefki/laravel-geoip
More information about reefki/laravel-geoip
Files in reefki/laravel-geoip
Package laravel-geoip
Short Description A Laravel package to get IP addresses geographical location.
License MIT
Informations about the package laravel-geoip
Laravel GeoIP
A Laravel package to get IP addresses geographical location.
Installation
This package can be installed through Composer.
Optionally, you can publish the config file of this package with this command:
Basic usage
Using facade to get information of an IP address:
By default the result will be cached, to get realtime data you can pass a boolean value as the second parameter:
Get visitor's IP address via request:
Get visitor's anonymized IP address:
Drivers
Laravel GeoIP support multiple drivers. By default, geojs
driver will be used if you don't specify the driver when using the facade or when calling geoip()
method via Laravel request instance.
You can change the default driver in your .env
file as:
Here are the drivers currently available for use.
GeoJS
This is a completly free service, you don't have to do anything to get it to work. Simply pass geojs
to the driver paremeter.
IPData
To use this driver, register an account and put the API key in your .env
file as:
To get the IP information using this driver you can pass ip-data
to the driver parameter:
Please note: IPData offers 1500 daily free requests. If your daily usage is more than 1500 you need to upgrade to one of their paid plan.
Testing
Run the tests with:
Credits
- Rifki Aria Gumelar
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-geoip with dependencies
illuminate/support Version ^9.0|^10.0
eventsauce/object-hydrator Version ^1.4
guzzlehttp/guzzle Version ^7.0
symfony/http-foundation Version ^6.3