geocoder-php / geocoder-service-provider
Geocoder service provider for Silex
Installs: 6 854
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 3
Open Issues: 1
pkg:composer/geocoder-php/geocoder-service-provider
Requires
- willdurand/geocoder: ^2.0
Requires (Dev)
- phpunit/phpunit: ^5.0
- silex/silex: ^1.0
- symfony/twig-bridge: ^2.2
This package is auto-updated.
Last update: 2025-10-28 03:46:22 UTC
README
Geocoder service provider for Silex.
Usage
Initialize the service provider using register() method:
<?php use Geocoder\Provider\GeocoderServiceProvider; $app->register(new GeocoderServiceProvider());
N.B.: be careful to register this provider after the
WebProfilerServiceProvider if you want Geocoder to be integrated in it.
Then use it in your controllers:
<?php $app->get('/hello', function() use ($app) { $geocoder = $app['geocoder']; // do your stuff });
Configuration
The service provider creates the following services:
- geocoder: the Geocoder instance ;
- geocoder.provider: the provider used by Geocoder ;
- geocoder.adapter: the HTTP adapter used to get data from remotes APIs.
By default, the geocoder.provider service uses FreeGeoIP and the
geocoder.adapter service uses the cURL adapter. Override these services to use
the adapter/provider you want.
See the Geocoder documentation for a list of available adapters and providers.
Installation
The recommended way to install GeocoderServiceProvider is through Composer:
{
    "require": {
        "geocoder-php/geocoder-service-provider": "@stable"
    }
}
Protip: you should browse the
geocoder-php/geocoder-service-provider
page to choose a stable version to use, avoid the @stable meta constraint.
Licence
GeocoderServiceProvider is released under the MIT License. See the bundled LICENSE file for details.