Download the PHP package creativefactoryrv/google-maps-geocoder without Composer
On this page you can find all versions of the php package creativefactoryrv/google-maps-geocoder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download creativefactoryrv/google-maps-geocoder
More information about creativefactoryrv/google-maps-geocoder
Files in creativefactoryrv/google-maps-geocoder
Package google-maps-geocoder
Short Description Simple and lightweight geocoder that uses the Google Maps Platform API. It can optionally use a PSR cache.
License MIT
Informations about the package google-maps-geocoder
Google Maps Geocoder
A super simple geocoding class that use Google Maps Platform to do the magic.
You only need to obtain a Google Geocoding API key (https://developers.google.com/maps).
Optionally, the class can leverage a PRS-6 cache implementation in order to query the Maps Platform only when necessary.
Install
How to use
Get a JSON
Return the Google Maps Platform API response as it is (JSON).
Get an array
Return the Google Maps Platform API response as an associative array.
Get latitude and longitude
Returns an array with the desired values.
Country
Returns the country value.
Locality (city)
Returns the city or locality value.
Postal code
Returns the postal code or zipcode value.
Route (street name)
Returns the street name (called "route" by Google).
Street number
Returns the street number value.
Administrative levels 1
Returns the administrative levels 1 value.
Administrative levels 2
Returns the administrative levels 2 value.
Administrative levels 3
Returns the administrative levels 3 value.
Formatted address
Returns a string representing the address (called "formatted_address" by Google).
Format as you like
Returns a formatted address according to $format.
- %A1 Administrative Area Level 1
- %a1 Administrative Area Level 1 (short version)
- %A2 Administrative Area Level 2
- %a2 Administrative Area Level 2 (short version)
- %A3 Administrative Area Level 3
- %a3 Administrative Area Level 3 (short version)
- %C Country
- %L Locality
- %P Postal code
- %R Route
- %N Street number
License
MIT