The Directions API uses widop/http-adapter which is a PHP 5.3 library for issuing http requests.
The Google Directions API is a service that calculates directions between locations using an HTTP request. You can search for directions for several modes of transportation, include transit, driving, walking or cycling. Directions may specify origins, destinations and waypoints either as text strings (e.g. "Chicago, IL" or "Darwin, NT, Australia") or as latitude/longitude coordinates. The Directions API can return multi-part directions using a series of waypoints.
By default, the bundle doesn't need any configuration. Most of the service have a default configuration which allows
you to use the given objects like they are. The fungio_google_map.geocoder
service is not one of them. The
configuration describes below is this default configuration but if you don't provide at least one value (for the
directions
or directions_request
nodes), the service will not be registered.
# app/config/config.yml
fungio_google_map:
directions:
# Enable the service
enabled: true
# Your own directions class
class: "My\Fucking\Directions"
# The http adapter
adapter: "widop_http_adapter.curl"
# The Directions API URL
url: "http://maps.googleapis.com/maps/api/directions"
# TRUE if the service uses HTTPS else FALSE
https: false
# The format used (json or xml)
format: "json"
$directions = $this->get('fungio_google_map.directions');
If you want to use it with a business account, you can read this documentation.
$response = $directions->route('New York', 'Washington');
The directions service allows you to route a much more advance request. If you want to learn more, you can read this documentation.
When you have requested your direction, the returned object is an
Fungio\GoogleMap\Services\Directions\DirectionsResponse
. If you want to learn more about the response, you
can read this documentation.