Artisan commands
geolocation:locate
Resolve an IP (or, with --address, a street address) through the configured pipeline and print the Location as a field/value table, or as JSON:
php artisan geolocation:locate 8.8.8.8
php artisan geolocation:locate "1600 Amphitheatre Pkwy" --address
php artisan geolocation:locate 8.8.8.8 --jsonThe command exits non-zero when nothing resolves — handy for smoke-testing credentials and your .mmdb wiring in CI or after a deploy. Once you configure a default location, a lookup always resolves, so check the type field in the output.
geolocation:db:update
Download or refresh the MaxMind database — a thin wrapper over Geolocation::updateDatabase(). --edition and --path override the configured edition and destination:
php artisan geolocation:db:update
php artisan geolocation:db:update --edition=GeoLite2-Country --path=/var/data/geo.mmdb- Fails with a clear error when MAXMIND_LICENSE_KEY is missing or no destination path is configured.
- Picks the {edition}.mmdb member from the archive (or the first .mmdb it finds), writes it beside the destination file and renames it over the old one, so running lookups never read a half-written file.
- Reports download and unpacking errors (license key redacted) and exits non-zero, so a scheduled run surfaces failures; the current database stays in place.
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 cryptoBy 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.