yrizos/distance

0.2.0 2014-09-29 17:38 UTC

This package is auto-updated.

Last update: 2024-04-23 23:24:26 UTC


README

PHP Wrapper around Google's DistanceMatrix.

instalation

Through composer

"require": {
    "yrizos/distance": "*"
}

usage

Instantiate Api Class with your API Key:

$api = new \DistanceMatrix\Api('apikey');

Add a destination (Required) :

$api->addDestination('Αγιου Γεωργίου 5, Θέρμη, Θεσσαλονίκη');

Add an origin (Required):

$api->addOrigin('Αριστοτέλους 35, Εύοσμος, Θεσσαλονίκη');

Set the Units :

  • metric (default)
  • imperial
$api->setUnits('imperial');

Set the Output :

  • json (default)
  • xml
$api->setOutput('xml');

Set the Mode :

  • bicycling
  • walking
  • driving (default)
$api->setMode('walking');

Set the Language :

  • en (default)
$api->setLanguage('el');

Finally, run this thing :

$results = $api->run();

license

MIT