PHPackages                             laravelcm/abstract-ip-geolocation - 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. laravelcm/abstract-ip-geolocation

ActiveLibrary

laravelcm/abstract-ip-geolocation
=================================

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.

v1.1.0(1y ago)3161MITPHPPHP ^8.2

Since May 15Pushed 1y ago2 watchersCompare

[ Source](https://github.com/laravelcm/abstract-ip-geolocation)[ Packagist](https://packagist.org/packages/laravelcm/abstract-ip-geolocation)[ GitHub Sponsors](https://github.com/mckenziearts)[ RSS](/packages/laravelcm-abstract-ip-geolocation/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (4)Used By (0)

 [ ![Laravel v10.x](https://camo.githubusercontent.com/32e4265cd553638f559729bcedc5c7dae4666cb11dec952135f022ac45714a1d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d7631302e782d464632443230) ](https://laravel.com) [ ![Total Downloads](https://camo.githubusercontent.com/0015c3dc7a148a1d2e0bd3d58aeb00e72dc82bf1a079bae8944eecf89d126d49/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61726176656c636d2f61627374726163742d69702d67656f6c6f636174696f6e) ](https://packagist.org/packages/laravelcm/abstract-ip-geolocation) [ ![Latest Stable Version](https://camo.githubusercontent.com/11921f51639bbd93ec3f16fa142ee8fe79779bfb93c01910508336fd27e4e7d9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61726176656c636d2f61627374726163742d69702d67656f6c6f636174696f6e) ](https://packagist.org/packages/laravelcm/abstract-ip-geolocation) [ ![License](https://camo.githubusercontent.com/eca66900a42c5a0d7168568e888ff1a7f4c066b0b3312cccae4553bc8e989fd6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c61726176656c636d2f61627374726163742d69702d67656f6c6f636174696f6e) ](https://packagist.org/packages/laravelcm/abstract-ip-geolocation)

[![Abstract API](https://camo.githubusercontent.com/fe1fcd5f85f6f493e593ef9cff2d41e28ebad6e5e7e45f0457159afc08311304/68747470733a2f2f6173736574732d676c6f62616c2e776562736974652d66696c65732e636f6d2f3635313636313236636131383234313733316161323662302f3635333930646536323463623635373730353630646461355f4641562e706e67)](https://www.abstractapi.com) Abstract’s IP Geolocation API Laravel Client Library
===========================================================================================================================================================================================================================================================================================================================================================================================================

[](#-abstracts-ip-geolocation-api-laravel-client-library)

### Getting Started

[](#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 .

### Installation

[](#installation)

The package works with PHP 8 and is available using [Composer](https://getcomposer.org).

```
composer require laravelcm/abstract-ip-geolocation
```

### Usage

[](#usage)

Open your application's `\app\Http\Kernel.php` file and add the following to the `Kernel::middleware` property:

```
protected $middleware = [
    ...
    \Laravelcm\AbstractIpGeolocation\Middleware\AbstractIpGeolocation::class,
];
```

#### Quick Start

[](#quick-start)

```
Route::get('/', function () {
    $geolocation = session()->get('abstract-ip-geolocation')
    $location = "The IP address " . $geolocation->ipAddress;
    return view('index', ['location' => $location]);
});
```

Will return the following string to the `index` view:

```
"The IP address 127.0.0.1"
```

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:

```
Laravelcm\AbstractIpGeolocation\DataObject\GeolocationData {#1164
  +ipAddress: "166.171.248.255"
  +city: "Paris"
  +cityGeonameId: 2997712
  +region: "Île-de-France"
  +regionIsoCode: "IDF"
  +regionGeonameId: 3012874
  +postalCode: "75002"
  +country: "France"
  +countryCode: "FR"
  +countryIsEU: true
  +continent: "Europe"
  +continentCode: "EU"
  +continentGeonameId: 3017382
  +longitude: 2.3024
  +latitude: 48.6939
  +security: Laravelcm\AbstractIpGeolocation\DataObject\Security {#839
    +isVpn: false
  }
  +timezone: Laravelcm\AbstractIpGeolocation\DataObject\Timezone {#1182
    +name: "Europe/Paris"
    +abbreviation: "CEST"
    +gmtOffset: 2
    +currentTime: "19:08:34"
    +isDST: true
  }
  +flag: Laravelcm\AbstractIpGeolocation\DataObject\Flag {#1165
    +svg: "https://static.abstractapi.com/country-flags/FR_flag.svg"
    +png: "https://static.abstractapi.com/country-flags/FR_flag.png"
    +emoji: "🇫🇷"
    +unicode: "U+1F1EB U+1F1F7"
  }
  +currency: Laravelcm\AbstractIpGeolocation\DataObject\Currency {#817
    +name: "Euros"
    +code: "EUR"
  }
  +connection: Laravelcm\AbstractIpGeolocation\DataObject\Connection {#425
    +connectionType: "Cable/DSL"
    +autonomousSystemNumber: 45980
    +autonomousSystemOrganization: "Free SAS"
    +ispName: "ProXad network / Free SAS"
    +organizationName: "Proxad / Free SAS"
  }
}
```

### Configuration

[](#configuration)

Config file are located at `config/abstract-ip-geolocation.php` after publishing provider element.

#### Fields

[](#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 ).

```
/*
|--------------------------------------------------------------------------
| Geolocation Fields
|--------------------------------------------------------------------------
| You can include a fields value in the query parameters with a comma
| separated list of the top-level keys you want to be returned. For example
| "fields => 'city,region'" will return only the city and region in the response.
|
| see: https://docs.abstractapi.com/ip-geolocation#request-parameters
*/

'fields' => null,
```

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()`.

```
$geolocation = session()->get('abstract-ip-geolocation');

$geolocation->country // return "France"
$currency = $geolocation->currency // instance of \Laravelcm\AbstractIpGeolocation\DataObject\Currency
```

#### DTO

[](#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
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

3

Last Release

717d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14105989?v=4)[Arthur Monney](/maintainers/Mckenziearts)[@mckenziearts](https://github.com/mckenziearts)

---

Top Contributors

[![mckenziearts](https://avatars.githubusercontent.com/u/14105989?v=4)](https://github.com/mckenziearts "mckenziearts (10 commits)")

---

Tags

laravelip geolocationabstract-api

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/laravelcm-abstract-ip-geolocation/health.svg)

```
[![Health](https://phpackages.com/badges/laravelcm-abstract-ip-geolocation/health.svg)](https://phpackages.com/packages/laravelcm-abstract-ip-geolocation)
```

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[christophrumpel/missing-livewire-assertions

This package adds missing livewire test assertions.

149336.0k9](/packages/christophrumpel-missing-livewire-assertions)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
