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

Location Laravel Package

stevebauman/location

Laravel package for detecting a visitor's location from their IP address. Multiple drivers including MaxMind, IP-API, and GeoPlugin return country, region, city, coordinates, timezone, currency, and more through a simple, expressive API. Quick setup and seamless Laravel integration.

View on GitHub
Deep Wiki
Context7

stevebauman/location is a Laravel package for detecting a visitor's geographical location from their IP address. It integrates several lookup services—including ipinfo, ipapi, MaxMind, GeoIP2, and ipdata—with configurable driver fallback, so a failed lookup can seamlessly try the next provider.

Results are returned as a clean value object exposing coordinates, country, region, city, timezone, and currency, with built-in caching to keep lookups fast and avoid redundant API calls.

  • Pluggable drivers with automatic fallback
  • Simple Location::get($ip) facade API
  • Coordinates, country, city, timezone, and currency
  • Response caching to reduce external requests
  • Laravel-native configuration and service provider
Frequently asked questions about Location
How do I install and configure stevebauman/location in Laravel?
Install the package with Composer, publish its config file, and set your chosen driver credentials in the environment. The package registers a Laravel service provider and facade, so you can resolve location data through the facade or the manager. Add middleware only if you want request-level location resolution.
Which IP geolocation drivers does stevebauman/location support?
The package uses a driver-based design and supports providers including MaxMind, ipinfo, IP2Location, Cloudflare, IP-API, IpData, ipapi, and others. You can configure a single driver or a primary and fallback driver chain. Custom drivers and Macroable extensions are supported for proprietary integrations.
Does stevebauman/location support Laravel 13?
The release history shows active Laravel compatibility tracking through Laravel 13, with steady patch releases and driver fixes. Check the package requirements and changelog for your exact Laravel version before upgrading. Pinning the version and reviewing release notes reduces framework-upgrade risk.
How do I cache IP location results in Laravel with this package?
Caching is built in and is important for production because external IP geolocation APIs add latency and rate-limit risk. Configure cache settings in the published config and choose a TTL based on how often location data needs to change. Cache results per IP or per user where appropriate.
How do I set up fallback drivers for IP geolocation?
Configure a primary driver and fallback drivers so lookups can continue if a provider fails. As of v7.7.0, the fallback chain can be time-bounded with a cap on lookup time across drivers. That makes fallback chains safer on the request path, but it does not remove provider dependency risk.
How can I fake location data in Laravel tests?
Use Location::fake and Position::make to return deterministic location data in tests. This lets you test localization, geo-blocking, and analytics flows without calling external APIs. It keeps tests fast and reliable.
Should I self-host MaxMind or use an API driver?
MaxMind can be self-hosted with local database files, which gives control but adds license management, database downloads, storage permissions, and update scheduling. API drivers require keys and external network calls but avoid local database operations. Choose the operating model up front rather than mixing both accidentally.
What are the accuracy limits of IP-based location detection?
Accuracy varies by driver, IP version, region, and network type. VPN, Tor, corporate proxy, datacenter, and mobile-carrier IPs can produce misleading locations. Avoid hard geo-blocking unless the business accepts false positives.
Is stevebauman/location suitable for GDPR and CCPA compliance?
IP-derived location can be personal data under GDPR and CCPA-like regimes, so privacy and compliance risk is material. Confirm consent, retention, disclosure, and data-processing requirements before broad rollout. The package provides location data, but your application must handle the privacy obligations.
Is stevebauman/location actively maintained and safe to upgrade?
Release history shows active Laravel compatibility tracking through Laravel 13 with steady patch releases and driver fixes. v7.7.0 fixes and simplifies the LocationManager::get() return type, so re-verify any internal wrapper or custom driver that type-hinted against the previous signature. Pin the version and review the changelog before upgrading.
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.
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
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo