stevebauman/location
Retrieve a user’s real location by IP in Laravel. Provides a simple facade/service, multiple driver support, caching options, and easy integration with requests, middleware, and geolocation providers for country, city, lat/long, and more.
Location::get()->countryCode to trigger app()->setLocale() or Currency::set()).Location::get()->countryCode === 'DE' ? applyVAT() : null).Location::isProxy() or Location::isHighRiskCountry()).Location::isNorthAmerica() ? showFeatureX() : null).Roadmap Tie-Ins:
Build vs. Buy:
Adopt if:
Location::isEu()).Look Elsewhere if:
For Executives: *"This package lets us deliver hyper-local experiences—like auto-translating interfaces, region-specific pricing, or geo-blocking content—without building a custom geolocation system. Think of it as ‘GPS for the web’:
For Engineering: *"This is a drop-in solution for geolocation in Laravel that handles the heavy lifting—provider abstraction, caching, and edge cases (VPNs, proxies, IPv6)—so we can focus on business logic. Key advantages:
Position object (e.g., Location::get()->countryCode) regardless of the provider (MaxMind, IPAPI, etc.).Location::fake()—no more flaky IP-based tests.Location::isEu()) for business rules.Example use cases we can tackle immediately:
app/Http/Middleware/GeoBlock.php).app()->setLocale() based on visitor IP.SELECT COUNT(*) FROM users GROUP BY country_code.Trade-offs:
Next Steps:
config/location.php.Location::isHighRiskCountry())."*How can I help you explore Laravel packages today?