NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages

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

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:

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:

use RoundlyConsulting\Geolocation\Facades\Geolocation;

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

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

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:

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

By donating, you agree to our donation terms.

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.