Download the PHP package laravelcm/abstract-ip-geolocation without Composer
On this page you can find all versions of the php package laravelcm/abstract-ip-geolocation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laravelcm/abstract-ip-geolocation
More information about laravelcm/abstract-ip-geolocation
Files in laravelcm/abstract-ip-geolocation
Package abstract-ip-geolocation
Short Description Abstract’s IP Geolocation API is a fast, lightweight, modern, and RESTful JSON API for determining the location and other details of IP addresses from over 190 countries.
License MIT
Informations about the package abstract-ip-geolocation
Abstract’s IP Geolocation API Laravel Client Library
Getting Started
Abstract’s IP Geolocation API is a fast, lightweight, modern, and RESTful JSON API for determining the location and other details of IP addresses from over 190 countries.
The free plan is limited to 1,000 requests per month. To enable all the data fields and additional request volumes see https://www.abstractapi.com/api/ip-geolocation-api#pricing.
Installation
The package works with PHP 8 and is available using Composer.
Usage
Open your application's \app\Http\Kernel.php
file and add the following to the Kernel::middleware
property:
Quick Start
Will return the following string to the index
view:
Mais par défaut cet object $geolocation
est une instance de la classe \Laravelcm\AbstractIpGeolocation\DataObject\GeolocationData
qui donne toutes les valeurs transformées de l'API (tableau) en objet PHP.
Les informations sont stockées par défaut dans la session depuis le middleware, ce qui vous permet d'avoir accès aux informations n'importe où dans votre code.
Voici le contenu de l'objet $geolocation
apres un dump:
Configuration
Config file are located at config/abstract-ip-geolocation.php
after publishing provider element.
Fields
By default, all fields are returned by the Abstract API, but you can choose to retrieve just the values you're interested in from the API. To do this, you need to specify the fields you want (the list of fields is available here https://docs.abstractapi.com/ip-geolocation#request-parameters).
Once you've specified the fields you want (e.g. country,currency
) only these values will be returned by the API and in your geolocations DTO object,
you'll only have the country
and currency
values available - the others will be null.
To access this information, consult session()
.
DTO
The available DTO classes are listed below. In the json return from the Abstract Geolocation API, all objects are represented by DTO classes
\Laravelcm\AbstractIpGeolocation\DataObject\GeolocationData
which represents the geolocation class containing all information relating to the user via its IP address\Laravelcm\AbstractIpGeolocation\DataObject\Connection
which represents the DTO class for its connection origin information\Laravelcm\AbstractIpGeolocation\DataObject\Currency
which represents the DTO class for the currency\Laravelcm\AbstractIpGeolocation\DataObject\Flag
which represents the DTO class for country flag information\Laravelcm\AbstractIpGeolocation\DataObject\Timezone
which represents the DTO class for Timezone information\Laravelcm\AbstractIpGeolocation\DataObject\Security
which represents the DTO class for security information, lets you know whether the user is using a VPN or not
License
This package is open-sourced software licensed under the MIT license.
All versions of abstract-ip-geolocation with dependencies
ext-json Version *
illuminate/support Version ^10.0|^11.0
spatie/laravel-package-tools Version ^1.15