PHPackages                             psonrie/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. psonrie/geolocation

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

psonrie/geolocation
===================

Laravel service provider to retrieve a users location by their IP Address

0.3.2(5y ago)01.2kMITPHPPHP &gt;=7.0

Since Sep 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Psonrie/geolocation)[ Packagist](https://packagist.org/packages/psonrie/geolocation)[ RSS](/packages/psonrie-geolocation/feed)WikiDiscussions master Synced today

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

[![Travis CI](https://camo.githubusercontent.com/e29bc2ee5536993da847530f24e8d40a28181ab936003a3b7c8f1875fb01187f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f70736f6e7269652f67656f6c6f636174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/psonrie/geolocation)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7b2f3cd375f4e9accfc40fd98104725d9bee012a6d66ea6e8f3d78f0fc6fa335/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f70736f6e7269652f67656f6c6f636174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/psonrie/geolocation/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/0eef6035571e46d344fd86b40914000c44071878d665f66877d8ef2252ab8da8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70736f6e7269652f67656f6c6f636174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/psonrie/geolocation)[![Total Downloads](https://camo.githubusercontent.com/2632a4591264ee320cbc7c525f18e92ebb3606f621c9c2ae24fe5f7ef3b07b4c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70736f6e7269652f67656f6c6f636174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/psonrie/geolocation)[![License](https://camo.githubusercontent.com/9866a4f0720ab552cb6ba8c8df919ea9cce3baf557b01eb2b1f8c27066cc1837/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f70736f6e7269652f67656f6c6f636174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/psonrie/geolocation)

Geo Location
============

[](#geo-location)

Laravel service provider to retrieve a users location from their IP address using [freegeoip.app](https://freegeoip.app/) or [geolocation-db](https://geolocation-db.com/) service.

Requirements
------------

[](#requirements)

- Laravel &gt;= 5.5
- PHP 7.0 or greater
- cURL extension enabled

Installation
------------

[](#installation)

Via Composer

```
composer require psonrie/geolocation
```

> **Note**: If you're using Laravel 5.5 or above, you can skip the registration of the service provider, as it is registered automatically.

Add the service provider in `config/app.php`:

```
Psonrie\GeoLocation\GeoLocationServiceProvider::class,
```

Publish the config file:

```
php artisan vendor:publish --provider="Psonrie\GeoLocation\GeoLocationServiceProvider"
```

Usage
-----

[](#usage)

#### Retrieving a users location

[](#retrieving-a-users-location)

```
$geoLocation = new GeoLocation();

$response = $geoLocation->get('46.24.247.56');

// Returns instance of Psonrie\GeoLocation\Response

Psonrie\GeoLocation\Response {
  ip: "46.24.247.56"
  countryCode: "ES"
  countryName: "Spain"
  regionCode: "CT"
  regionName: "Catalonia"
  cityName: "Barcelona"
  zipCode: "08004"
  timeZone: "Europe/Madrid"
  latitude: "41.3891"
  longitude: "2.1611"
  metroCode: 0
}
```

Contribute
----------

[](#contribute)

Contributions are welcome! Send a pull request to the [main repository](https://github.com/Psonrie/geolocation) or report any issues you find on the [issue tracker](https://github.com/Psonrie/geolocation/issues).

License
-------

[](#license)

The MIT License (MIT). Please see [LICENSE](LICENSE) for more information.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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 ~58 days

Total

5

Last Release

1897d ago

PHP version history (2 changes)0.1PHP &gt;=5.6.0

0.2PHP &gt;=7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3418982?v=4)[Germán](/maintainers/gertoska)[@gertoska](https://github.com/gertoska)

---

Top Contributors

[![gertoska](https://avatars.githubusercontent.com/u/3418982?v=4)](https://github.com/gertoska "gertoska (19 commits)")

---

Tags

phplaravelgeoipIPlocationgeogeo-locationfreegeoip

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/psonrie-geolocation/health.svg)

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

###  Alternatives

[stevebauman/location

Retrieve a user's location by their IP Address

1.3k8.5M89](/packages/stevebauman-location)[torann/geoip

Support for multiple Geographical Location services.

2.2k15.3M98](/packages/torann-geoip)[hibit-dev/geodetect

Automatically detect user's geo data based on their IP address

2322.8k](/packages/hibit-dev-geodetect)[victorybiz/geoip-location

Get the geographical location of website visitors based on their IP addresses. Support Laravel and PHP (Non-Laravel) Project.

23167.8k2](/packages/victorybiz-geoip-location)

PHPackages © 2026

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