---
title: "Installation — Geolocation for Laravel | Roundly"
description: "Install via Composer, optionally publish the config, and resolve your first location in one line — no migrations to run."
url: https://roundly-consulting.com/open-source/docs/geolocation-for-laravel/installation
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Geolocation for Laravel](https://roundly-consulting.com/open-source/docs/geolocation-for-laravel.md)

# Installation

Require the package. The service provider and the global Geolocation facade alias are auto-discovered — no manual registration, and no migrations:

```bash
composer require roundly-consulting/geolocation-for-laravel
```

The config file is optional — every key has an env-backed default. Publish it only when you want to reorder the pipeline, register your own providers or tune rate limits:

```bash
php artisan vendor:publish --tag="geolocation-config"
```

## First lookup

Out of the box both MaxMind providers are disabled, and an IP lookup goes to ip2location.io and then ipinfo.io — both answer without a key, as unauthenticated requests. The default fallback stays silent until you configure it, so an IP nothing can place returns null. One call resolves the visitor:

```php
use RoundlyConsulting\Geolocation\Facades\Geolocation;

$location = Geolocation::locateRequest();   // walks the pipeline for the client IP

$location?->city;           // "Mountain View"
$location?->countryIsoCode; // "US"
```

Address and coordinate lookups and distances go through Google and need GOOGLE\_MAPS\_API\_KEY in your .env, with the Geocoding API and the Routes API enabled on that key.

Before going to production, trim the pipeline to the providers you actually have credentials for — or to the offline MaxMind database alone, if visitor IPs must stay on your servers. See How it works.

## Check the wiring

The package contributes a Geolocation section to php artisan about with the active pipeline and whether caching and events are on. It never prints credentials:

```bash
php artisan about   # adds a "Geolocation" section: Pipeline, Cache, Events
```

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/geolocation-for-laravel.md)
