stevebauman/location
Retrieve a user’s geolocation from their IP in Laravel. Provides a simple Location facade to get city, region, country, coordinates, timezone and more, with multiple driver support (e.g., IP2Location, IP-API, MaxMind) plus caching and testing helpers.
Personalization & Localization:
Compliance & Security:
auth middleware to restrict access to specific countries (e.g., "US-only features" for SaaS).Analytics & Business Intelligence:
Build vs. Buy Decision:
Monetization Strategies:
Use Cases by Vertical:
Adopt if:
Look Elsewhere if:
geoip2/geoip2 or jenssegers/agent).For Executives: *"This package lets us deliver personalized, compliant, and data-driven experiences without building a custom geolocation system. Here’s why it’s a no-brainer:
For Engineers: *"This is a drop-in Laravel facade for IP geolocation with:
Location::fake()).Location::macro('continent', fn() => ...)).
Tradeoffs:app/Http/Middleware/SetGeoData.php).public function handle($request, Closure $next) {
$request->merge(['geo' => Location::get()]);
return $next($request);
}
Testing: Use Location::fake() to mock locations in CI/CD or feature flags."*
For Design/Marketing Teams: *"This unlocks geo-targeted features without dev overhead:
How can I help you explore Laravel packages today?