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
Mapquest Provider

Mapquest Provider Laravel Package

geocoder-php/mapquest-provider

MapQuest provider for the Geocoder PHP library. Adds forward and reverse geocoding via MapQuest’s API so you can convert addresses to coordinates (and back) in a consistent Geocoder interface, using your MapQuest API key and configuration options.

View on GitHub
Deep Wiki
Context7

[READ ONLY] Provider for MapQuest

Frequently asked questions about Mapquest Provider
How do I integrate MapQuest geocoding into my Laravel app?
First, install the package via Composer: `composer require geocoder-php/geocoder mapquest-provider`. Then, configure your MapQuest API key in `.env` (e.g., `MAPQUEST_API_KEY=your_key`). Use the Geocoder facade or service to register the provider and call `geocode()` or `reverseGeocode()` methods. Laravel’s service container will handle the rest.
What Laravel versions does this package support?
The package works with Laravel 8.x and 9.x, as it relies on Geocoder PHP, which is framework-agnostic. Ensure your Laravel app uses PHP 8.0+ for compatibility. No Laravel-specific dependencies exist beyond the base Geocoder library.
Can I use this package without Geocoder PHP?
No, this provider is designed as a plugin for the Geocoder PHP library. You must install `geocoder-php/geocoder` as a dependency. It acts as a wrapper for MapQuest’s API, providing a consistent interface for geocoding operations.
How do I handle API rate limits in production?
MapQuest’s free tier has strict limits (e.g., 10,000 requests/month). To mitigate this, implement caching (e.g., Redis) for frequent queries. The Geocoder library supports caching providers like `geocoder-php/cache-provider-redis`. For high-volume apps, consider upgrading to a paid MapQuest plan.
What’s the best way to test this provider in Laravel?
Mock the HTTP client (e.g., Guzzle) in your tests to avoid hitting MapQuest’s API. Use PHPUnit to verify geocoding results for known addresses and coordinates. Test edge cases like invalid inputs or API failures with retry logic. Laravel’s HTTP testing tools can also simulate API responses.
Does this package support reverse geocoding (coordinates to address)?
Yes, the MapQuest provider supports both forward (address → coordinates) and reverse geocoding (coordinates → address). Use the `reverseGeocode()` method with an array of `[latitude, longitude]` to fetch address details from MapQuest’s API.
What alternatives exist if MapQuest’s API is unreliable?
Geocoder PHP supports multiple providers, including OpenStreetMap (`geocoder-php/geocoder-provider-openstreetmap`), Google (`geocoder-php/geocoder-provider-google-maps`), and others. You can register multiple providers and implement fallback logic in your application to switch if MapQuest fails.
How do I configure the provider for Symfony instead of Laravel?
For Symfony, define the provider as a service in `config/services.yaml` with the API key from environment variables. Inject the `MapQuestProvider` into your geocoding service and register it with the Geocoder instance. Symfony’s dependency injection will handle the rest, just like in Laravel.
Will this package work with PHP 7.4?
No, this package requires PHP 8.0 or higher. Check the `composer.json` for the latest supported PHP version. If you’re using an older PHP version, consider alternatives like OpenStreetMap, which may have broader compatibility.
How do I cache geocoding results to reduce API calls?
Use Geocoder PHP’s caching providers, such as Redis or file-based caching. Configure the cache provider in your Geocoder instance (e.g., `$geocoder->registerProvider(new MapQuestProvider('API_KEY', new RedisCacheProvider()))`). This will store results locally and reduce redundant API calls to MapQuest.
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