PHPackages                             divineomega/laravel-geolocation-request - 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. divineomega/laravel-geolocation-request

Abandoned → [jord-jd/laravel-geolocation-request](/?search=jord-jd%2Flaravel-geolocation-request)Library[Utility &amp; Helpers](/categories/utility)

divineomega/laravel-geolocation-request
=======================================

Laravel Geolocation Request

v2.0.0(6mo ago)3931LGPL-3.0-onlyPHPPHP &gt;=7.1CI passing

Since Jul 6Pushed 4w agoCompare

[ Source](https://github.com/Jord-JD/laravel-geolocation-request)[ Packagist](https://packagist.org/packages/divineomega/laravel-geolocation-request)[ GitHub Sponsors](https://github.com/DivineOmega)[ RSS](/packages/divineomega-laravel-geolocation-request/feed)WikiDiscussions master Synced 4w ago

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

Laravel Geolocation Request
===========================

[](#laravel-geolocation-request)

[![Tests](https://github.com/Jord-JD/laravel-geolocation-request/actions/workflows/tests.yml/badge.svg)](https://github.com/Jord-JD/laravel-geolocation-request/actions/workflows/tests.yml)

The Laravel Geolocation Request package provides an easy way to geolocate requests to their country of origin, simply by calling a `$request->country()` method.

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

[](#installation)

To install the Laravel Geolocation Request package, just run the following Composer command.

```
composer require jord-jd/laravel-geolocation-request
```

Version 3 supports Laravel 8 through Laravel 13 on PHP 8.1 and newer. Laravel 13 requires PHP 8.3 or newer.

Usage
-----

[](#usage)

To use geolocation enabled requests within your Laravel controller methods, you can replace the `use Illuminate\Http\Request` line at the top of your controllers, as shown in the usage example below.

Once done, you can simple call the `$request->country()` method to perform geolocation and return the origin country of the active request based on its IP address. The country is returned as an object containing many properties, such as the country name and ISO codes.

```
