Weave Code
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
Geo Plugin Provider

Geo Plugin Provider Laravel Package

geocoder-php/geo-plugin-provider

GeoPlugin provider for the Geocoder PHP library. Turns IP addresses into location data (country, region, city, coordinates) using GeoPlugin’s API. Easy drop-in provider for apps that need basic IP geolocation and locale-aware results.

View on GitHub
Deep Wiki
Context7

[READ ONLY] Provider for GeoPlugin

Frequently asked questions about Geo Plugin Provider
Is the GeoPlugin API still active for use in Laravel with this package?
As of the latest updates, GeoPlugin’s free API appears deprecated (last release noted in 2025-04-16). Verify via GeoPlugin’s status page or test endpoints before integration. If inactive, consider alternatives like MaxMind GeoIP2 or Nominatim for open-source solutions.
How do I install and configure this package in Laravel 10?
Run `composer require geocoder-php/geo-plugin-provider` and add your GeoPlugin API key to `.env` as `GEOPLUGIN_API_KEY=your_key`. Bind the provider in a Laravel service provider by registering `GeoPluginProvider` with the Geocoder instance. Ensure `geocoder-php/geocoder` (≥v4.0) is installed for Laravel 10 compatibility.
What Laravel versions does this package officially support?
The package doesn’t explicitly state Laravel 10+ support, but it works with `geocoder-php/geocoder` v4+, which is Laravel 10-compatible. Test thoroughly in your environment, especially if using Laravel’s service container or facades, as dependency conflicts may arise.
Can I cache geocoding results to reduce API calls and improve performance?
Yes, leverage Laravel’s caching mechanisms like `cache()->remember()` or Redis to store geocoding results. For high-volume apps, implement a hybrid approach: cache frequent queries (e.g., static IPs) while falling back to the API for dynamic requests. This mitigates GeoPlugin’s rate limits (1,000 requests/day).
What data does this provider return, and how can I use it in Eloquent models?
The provider returns structured data like latitude, longitude, country, city, and postal code, normalized for consistency. Attach these to Eloquent models via accessors (e.g., `getCoordinatesAttribute()`) or store them in a `geocode` JSON column. Example: `$user->geocode = $geocoder->geocode($ip)->first()->getCoordinates();`
Are there alternatives if GeoPlugin’s API is unreliable or deprecated?
Yes, consider MaxMind GeoIP2 (free tier via `geoip2/geoip2`), commercial APIs like Google Maps or Mapbox, or open-source Nominatim (OpenStreetMap-based). For Laravel, wrap these in a custom Geocoder provider to maintain consistency. Always test accuracy and rate limits before migrating.
How do I handle API errors like rate limits or timeouts in production?
Use Laravel’s `retry()` helper or queue delayed jobs (e.g., `dispatch(new GeocodeJob($ip))->delay(now()->addMinute())`) to retry failed requests. Implement a fallback provider (e.g., cached results or a secondary API) in your service container. Log errors via Laravel’s logging system for monitoring.
Does this package support reverse geocoding (coordinates to address)?
Yes, the GeoPlugin provider supports reverse geocoding via the Geocoder library’s `reverse()` method. Pass coordinates (e.g., `[lat, lng]`) to retrieve structured addresses like `{'country': 'US', 'city': 'San Francisco'}`. Cache results aggressively, as reverse geocoding may hit API limits faster than IP geolocation.
Can I use this for GDPR-compliant IP geolocation in the EU?
IP geolocation may require user consent under GDPR if tied to personal data. Consult legal/compliance teams to assess risks. Anonymize or aggregate data where possible, and disclose geolocation practices in your privacy policy. Avoid storing raw IP addresses; use hashed or truncated values if needed.
How do I integrate this with Laravel’s HTTP responses or APIs (e.g., Sanctum/Passport)?
Format geocoding results as JSON responses using Laravel’s `response()->json()` or API resources. For Sanctum/Passport, attach geodata to authenticated user payloads (e.g., `$user->append(['geocode'])`). Example: `return response()->json(['location' => $geocoder->geocode($request->ip)->first()->getCoordinates()]);`
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.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor