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

Openrouteservice Provider Laravel Package

geocoder-php/openrouteservice-provider

OpenRouteService provider for Geocoder PHP. Integrates ORS geocoding into the Geocoder ecosystem via a simple provider class, supporting forward and reverse geocoding through the OpenRouteService API with configurable HTTP client and API key.

View on GitHub
Deep Wiki
Context7

Geocoder OpenRouteService adapter

Frequently asked questions about Openrouteservice Provider
How do I install the OpenRouteService provider in Laravel?
Run `composer require geocoder-php/openrouteservice-provider` to install the package. Then register the provider in your `config/services.php` with your ORS API key or endpoint URL. The package works with Laravel’s service container, so you can bind it as a singleton or facade for easy access.
Does this package support self-hosted OpenRouteService instances?
Yes, the provider supports both cloud and self-hosted OpenRouteService instances. Configure the endpoint URL in your `.env` file (e.g., `ORS_URL=http://localhost:8080`) and ensure your self-hosted instance is running with PostgreSQL/PostGIS for full functionality.
What Laravel versions and PHP versions are supported?
This package is compatible with Laravel 8+ and requires PHP 8.0 or higher. It relies on Geocoder PHP v4+, which has broad Laravel version support. Always check the package’s dependencies for the latest compatibility notes.
How can I cache responses to avoid hitting API rate limits?
Use Laravel’s caching system (Redis or Memcached) to store geocoding results. For example, wrap API calls in `Cache::remember()` with a TTL of 1 hour for dynamic data like traffic or 24 hours for static addresses. This reduces API calls and improves performance.
Can I use this package for reverse geocoding (coordinates to addresses)?
Yes, the OpenRouteService provider supports both geocoding (address to coordinates) and reverse geocoding (coordinates to address). The Geocoder PHP library handles these operations seamlessly, and you can call them via the provider’s methods like `$geocoder->reverse($latitude, $longitude)`.
What happens if the OpenRouteService API is down or rate-limited?
The package doesn’t include built-in fallback logic, but you can implement it by wrapping the provider in a custom service class. For example, use a secondary provider (like Google Maps) or return cached data if the API fails. Laravel’s exception handling can also log failures for monitoring.
How do I integrate this with Laravel Scout for geospatial search?
While this package focuses on geocoding, you can combine it with Laravel Scout for full-text search by storing geocoded coordinates in your database. Use Eloquent’s spatial queries (e.g., `DB::raw('ST_Distance')`) to filter results based on proximity, and Scout can index these coordinates for faster searches.
Are there any alternatives to this package for Laravel geocoding?
Yes, alternatives include using the `geocoder-php/geocoder` package directly with other providers like Google Maps, Mapbox, or Nominatim. For routing-specific needs, you could also integrate ORS directly via Guzzle or Laravel’s HTTP client without the provider wrapper. However, this package simplifies ORS integration specifically.
How do I test geocoding functionality in my Laravel app?
Mock the OpenRouteService API responses in PHPUnit using Guzzle’s `HandlerStack` to simulate successful or failed requests. Test edge cases like invalid addresses, API rate limits, and self-hosted ORS failures. Use Laravel’s `Http` facade or Guzzle directly in your tests for flexibility.
Can I use this package for bulk geocoding or large datasets?
For bulk geocoding, offload the process to Laravel queues (e.g., `GeocoderJob`) to avoid timeouts. Cache results aggressively and consider batching requests to stay within ORS’s rate limits. Self-hosting ORS may be more cost-effective for high-volume applications, but it requires additional infrastructure.
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.
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core