How stevebauman/location works
Location is a Laravel package that resolves an IP address into a normalized Position using configurable online or local providers. The main workflow is application lookup → facade/manager → request construction and driver selection → provider lookup (with fallbacks) → Position. It also supports MaxMind database updates and shared-storage caching, Cloudflare request-header geolocation, and a fake for application testing. Some provider and request-adapter internals were not excerpted; their grouping and links are limited to README or SOURCE INDEX evidence.
Main entry points: LocationManager.php Location manager · Driver.php Driver fallback chain · Location.php Location facade · MaxMind.php MaxMind lookup
Components 17
Lookup entry
- Location facade
src/Facades/Location.php
Lookup orchestration
- Location manager
src/LocationManager.php - Location request
src/LocationRequest.php - Request contract
src/Request.php - Lookup deadline
src/Deadline.php - Driver fallback chain
src/Drivers/Driver.php - Position result
src/Position.php
Location providers
- HTTP driver base
src/Drivers/HttpDriver.php - HTTP geolocation providers
src/Drivers - Cloudflare headers
src/Drivers/Cloudflare.php
MaxMind data
- MaxMind lookup
src/Drivers/MaxMind.php - Local database cache
src/Drivers/LocalMaxMindDatabase.php - Database update command
src/Commands/Update.php
Package support
- Location fake
src/LocationFake.php - Service provider
src/LocationServiceProvider.php
Other components
- Laravel application
- Geolocation APIs
Connections 19
- Laravel application → Location facade: requests lookup
readme.md - Location facade → Location manager: resolves to
src/Facades/Location.php - Location manager → Location request: builds request
src/LocationManager.php - Location manager → Lookup deadline: limits lookup
src/LocationManager.php - Location manager → Driver fallback chain: dispatches lookup
src/LocationManager.php - Location request → Request contract: implements
src/LocationRequest.php - Driver fallback chain → HTTP driver base: uses for HTTP
src/Drivers/HttpDriver.php - Driver fallback chain → MaxMind lookup: runs fallback
src/Drivers/MaxMind.php - HTTP driver base → Geolocation APIs: requests geolocation
src/Drivers/HttpDriver.php - HTTP geolocation providers → HTTP driver base: extends base
src/Drivers/Ip2locationio.php - Cloudflare headers → Request contract: reads headers
src/Drivers/Cloudflare.php - MaxMind lookup → Local database cache: reads database
src/Drivers/MaxMind.php - MaxMind lookup → Position result: hydrates result
src/Drivers/MaxMind.php - Driver fallback chain → Position result: creates result
src/Drivers/Driver.php - Location facade → Location fake: installs fake
src/Facades/Location.php - Service provider → Location manager: registers singleton
src/LocationServiceProvider.php - Service provider → Local database cache: binds cache
src/LocationServiceProvider.php - Database update command → Location facade: gets drivers
src/Commands/Update.php - Database update command → MaxMind lookup: updates database