Laravel package to get IP Address geo location info from ip2location API.
-
IpLocApi
facade to utilize the package. - Extract Ip Address from
request
object fromx-forwarded-for
header if exists or throughip()
method. Available throughIpLocApi::getIpAddress($request)
. - Get Ip address location object from
ip2location
API service, available throughIpLocApi::getIpLocation($ipAddress)
method. - Ip Location data provided by the API available on object form of
IpLocSpec
which hasinArray
method to provide the data in array form.
Other useful features will be added on later version such as caching
the response to reduce external API calls, this can be done through an aliased middleware
.
API Service provided by https://www.ip2location.io/
, there for an account is required, service.base_url
and service.api_key
needs to be defined in the app .env
file.