valerian / google-distance-matrix
Google距离矩阵API - 为多个目的地估算旅行时间和距离。
v0.0.1
2016-12-02 15:49 UTC
Requires
- php: >=5.5.0
- guzzlehttp/guzzle: ^6.2
This package is not auto-updated.
Last update: 2024-09-23 13:42:07 UTC
README
为多个目的地估算旅行时间和距离。
需求
需要PHP 5.5.0或更高版本。
安装
安装valerian/google-distance-matrix的最佳方式是使用Composer
$ composer require valerian/google-distance-matrix
入门
$distanceMatrix = new GoogleDistanceMatrix('YOUR API KEY'); $distance = $distanceMatrix->setLanguage('cs') ->setOrigin('49.950096, 14.668544') ->setDestination('50.031817, 14.490880') ->sendRequest();
$distanceMatrix = new GoogleDistanceMatrix('YOUR API KEY'); $distance = $distanceMatrix->setLanguage('cs') ->setOrigin('K Habrovci 447, 251 63 Strančice, Česká republika') ->setDestination('Roztylská 2321/19, Chodov, 148 00 Praha-Praha 11, Česká republika') ->setMode(GoogleDistanceMatrix::MODE_WALKING) ->setLanguage('en-GB') ->setUnits(GoogleDistanceMatrix::UNITS_IMPERIAL) ->setAvoid(GoogleDistanceMatrix::AVOID_HIGHWAYS) ->sendRequest();
更多信息,请访问 https://developers.google.com/maps/documentation/distance-matrix/