How makidizajnerica/laravel-geolocation works
Laravel GeoLocation accepts an IP through its facade or Request macro, resolves a configured provider, performs a lookup, normalizes provider-specific fields, and returns a Collection. The manager also checks in-memory and Laravel cache results and can report driver failures. README documents four providers and custom-driver support; the shown source establishes the shared HTTP, endpoint, and formatting layers, but not every provider’s internal implementation, so those details are left out.
Main entry points: GeoLocationManager.php Lookup manager · GeoLocationDriver.php Driver base · geolocation.php Driver configuration · HandlingHttpResponse.php HTTP response handling
Components 23
Laravel entry points
- Request macro
src/GeoLocationServiceProvider.php - GeoLocation facade
src/Facades/GeoLocation.php - Service provider
src/GeoLocationServiceProvider.php
Lookup orchestration
- Driver configuration
config/geolocation.php - Lookup manager
src/GeoLocationManager.php - Request memory cache
src/GeoLocationManager.php - Laravel cache
src/GeoLocationManager.php
Provider drivers
- Driver base
src/GeoLocationDriver.php - Driver contract
src/Contracts/GeoLocationDriver.php - IPWhoIs driver
src/Drivers/IPWhoIs.php - GeoPlugin driver
src/Drivers/GeoPlugin.php - AbstractApi driver
src/Drivers/AbstractApi.php - IPData driver
src/Drivers/IPData.php
Driver support
- Endpoint formatter
src/Support/ApiEndpointFormatter.php - HTTP response handling
src/Support/HandlingHttpResponse.php - Response formatter
src/Support/ResponseDataFormatter.php - Array helper
src/Support/Arr.php - Driver exception
src/Exceptions/GeoLocationDriverException.php
Other components
- Laravel application
- IPWhoIs service
- GeoPlugin service
- AbstractApi service
- IPData service
Connections 31
- Laravel application → GeoLocation facade: calls lookup
README.md - Laravel application → Request macro: uses macro
README.md - Request macro → GeoLocation facade: calls lookup
src/GeoLocationServiceProvider.php - Service provider → Lookup manager: registers
src/GeoLocationServiceProvider.php - Service provider → Request macro: registers
src/GeoLocationServiceProvider.php - GeoLocation facade → Lookup manager: resolves binding
src/GeoLocationServiceProvider.php - Lookup manager → Driver configuration: reads settings
src/GeoLocationManager.php - Lookup manager → Request memory cache: checks and stores
src/GeoLocationManager.php - Lookup manager → Laravel cache: reads and writes
src/GeoLocationManager.php - Lookup manager → Driver contract: invokes driver
src/GeoLocationManager.php - Driver configuration → IPWhoIs driver: configures
config/geolocation.php - Driver configuration → GeoPlugin driver: configures
config/geolocation.php - Driver configuration → AbstractApi driver: configures
config/geolocation.php - Driver configuration → IPData driver: configures
config/geolocation.php - IPWhoIs driver → Driver base: extends
src/Drivers/IPWhoIs.php - IPData driver → Driver base: extends
src/Drivers/IPData.php - Driver base → Driver contract: implements
src/GeoLocationDriver.php - Driver base → Endpoint formatter: uses
src/GeoLocationDriver.php - Driver base → HTTP response handling: uses
src/GeoLocationDriver.php - Driver base → Response formatter: uses
src/GeoLocationDriver.php - IPWhoIs driver → HTTP response handling: calls lookup
src/Drivers/IPWhoIs.php - IPData driver → HTTP response handling: calls lookup
src/Drivers/IPData.php - HTTP response handling → Endpoint formatter: requests URL
src/Support/HandlingHttpResponse.php - HTTP response handling → Driver exception: throws on failure
src/Support/HandlingHttpResponse.php - Lookup manager → Driver exception: catches and reports
src/GeoLocationManager.php - Endpoint formatter → Array helper: merges parameters
src/Support/ApiEndpointFormatter.php - Response formatter → Array helper: reads fields
src/Support/ResponseDataFormatter.php - IPWhoIs driver → IPWhoIs service: queries
- GeoPlugin driver → GeoPlugin service: queries
- AbstractApi driver → AbstractApi service: queries
- IPData driver → IPData service: queries