Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Geolocation

Laravel Geolocation Laravel Package

adrianorosa/laravel-geolocation

Detect visitors' location in Laravel with this simple, configurable geolocation package. Resolve IP addresses to country, city, coordinates, timezone, currency, and more, with built-in caching and provider options. Great for localization, geo-targeted content, pricing, and compliance.

View on GitHub
Deep Wiki
Context7

Laravel Geolocation provides a simple, driver-based way to resolve IP addresses into geographic information inside Laravel applications. It wraps multiple geolocation providers behind a consistent API, so you can swap services without touching your application code while keeping configuration centralized and predictable.

Designed to fit naturally into the framework, the package includes configuration publishing, container binding, and caching support to keep lookups fast and cost-efficient.

  • Unified API across multiple geolocation drivers
  • Lookups for country, region, city, and coordinates
  • Caching layer to reduce external API requests
  • Laravel-native config and service container integration
  • Extensible drivers for custom providers
Frequently asked questions about Laravel Geolocation
How do I install adrianorosa/laravel-geolocation in a Laravel app?
Install it with composer require adrianorosa/laravel-geolocation, then publish the config if the package provides one and optionally register the facade alias. The assessment describes this as a low-friction service-provider, facade, and config package. Confirm the exact publish and alias commands in the README for your Laravel version.
Which Laravel and PHP versions does laravel-geolocation support?
The provided overview does not list a version matrix. Check the package's composer.json and CI matrix before adopting it in an existing Laravel application. Treat the release metadata as unverified until you confirm it against the tag history.
What data can I get from an IP address with this package?
The package resolves country, city, region, and coordinate data for a given IP address, according to the overview. It is intended for coarse location awareness rather than compliance-grade geolocation. Expect city-level accuracy to vary by IP type and network conditions.
Does laravel-geolocation work offline or require a third-party API?
The overview describes a lightweight wrapper but does not name the upstream provider or confirm an offline driver. Check whether it uses MaxMind GeoLite2, a downloadable database, or a public HTTP API. If only a third-party API is supported, evaluate latency, quotas, and air-gapped constraints before production use.
How does laravel-geolocation handle IPv6, private IPs, and X-Forwarded-For?
The technical assessment flags IPv6, private and reserved ranges, and proxy headers as edge cases to verify explicitly. The package overview does not state its handling for X-Forwarded-For or CGNAT addresses. Test private IPs and trusted proxy configuration in your app before relying on the result.
Can I use laravel-geolocation for localization and geo-based redirects?
Yes, coarse country and city data is a reasonable fit for locale defaults, regional content, and geo-based redirects. Keep it out of authorization or payment-fraud decisions unless you have an independent verification source. Use the resolved country primarily as a default that users can override.
Does laravel-geolocation cache results or respect rate limits?
The provided material does not document caching, retries, timeouts, or rate-limit behavior. If the package calls an external API, add application-level caching and timeout handling rather than assuming the wrapper does it. Confirm the provider's quotas and terms before high-volume use.
Is laravel-geolocation suitable for GDPR-sensitive production use?
An IP address can be personal data under GDPR and similar regimes, so sending visitor IPs to a third-party API is a data-processing decision. The assessment calls privacy and regulatory review the biggest gating item. Review the provider's DPA and data-retention posture, or prefer a local database driver, before production use.
How should I test or abstract laravel-geolocation in my application?
Define an application-owned contract such as GeoResolver::forIp(string): GeoResult and bind the package implementation to it in a service provider. Avoid referencing the package facade or DTOs outside that adapter so you can fake the resolver in tests. This also makes it straightforward to swap in geoip2 or another provider later.
What are alternatives to laravel-geolocation and how hard is it to switch?
Common alternatives include MaxMind's first-party tooling, geoip2, and stevebauman/location, as noted in the assessment. The package category is commoditized, so switching cost is low if you isolate it behind your own interface. Compare offline database support, IPv6 handling, and licensing before choosing.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect