rezzza/google-geocoder

This package is abandoned and no longer maintained. No replacement package was suggested.

Easy wrap Google geocoder web service

v2.1 2016-01-04 15:23 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:50:08 UTC


README

Build Status Simple lib to wrap Google geocoder Web Service

Installation

$ composer require rezzza/google-geocoder

Usage

You should build on your own the repository :

$googleAddressRepository = new Rezzza\GoogleGeocoder\GoogleAddressRepository(
    new Rezzza\GoogleGeocoder\GoogleGeocodeClient(
        new Ivory\HttpAdapter\CurlHttpAdapter(),
        'YOUR_GOOGLE_API_KEY'
    ),
    new Rezzza\GoogleGeocoder\Model\AddressFactory
);

Then you can use all methods available in the repository :

  • findByPlaceIdWithLanguage($placeId, $language)
  • findByCoordinatesWithLanguage($latitude, $longitude, $language)
  • findByAddressWithLanguage($address, $language)
  • findByLocalityAndCountryCodeWithLanguage($locality, $countryCode, $language)
  • findByLocalityAndCountryCodeAndAministrativeAreaWithLanguage($locality, $countryCode, $administrativeArea, $language)

All these methods will return a Rezzza\GoogleGeocoder\Model\AddressCollection except the first one that will return directly a Rezzza\GoogleGeocoder\Model\Address (as a placeId is uniq).