Download the PHP package adamb/google-maps-geocoder without Composer
On this page you can find all versions of the php package adamb/google-maps-geocoder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package google-maps-geocoder
GoogleMapsGeocoder
A PHP wrapper for the Google Maps Geocoding API v3.
Developed by Justin Stayton while at Monk Development.
Requirements
- PHP >= 5.2.0
Installation
Composer
The recommended installation method is through
Composer, a dependency manager for PHP. Just add
adamb/google-maps-geocoder
to your project's composer.json
file:
More details can be found over at Packagist.
Manually
- Copy
src/GoogleMapsGeocoder.php
to your codebase, perhaps to thevendor
directory. - Add the
GoogleMapsGeocoder
class to your autoloader orrequire
the file directly.
Getting Started
We'll use the address of Monk Development for this example:
There are two ways to set the address of a GoogleMapsGeocoder
object. Either
the address can be passed to the constructor:
Or the address can be set after the object is created:
By default, the format
is set to json
and the sensor
is set to false
.
These values can be changed either through the constructor or after the object
is created. See the
documentation
for the complete list of API parameters that can be changed.
Once all parameters are set, the final step is to send the request to the Google Maps Geocoding API:
The geocode
method converts the response into a JSON associative array
(default) or SimpleXMLElement
object depending on the specified format
. See
the geocode
documentation
for making the request over HTTPS or preventing conversion (instead returning
the raw plain text response).
Contributing
- Fork it.
- Create your feature branch (
git checkout -b my-new-feature
). - Commit your changes (
git commit -am 'Added some feature'
). - Push to the branch (
git push origin my-new-feature
). - Create a new Pull Request.