finalbytes / google-distance-matrix-api
Google distance matrix API - Estimate travel time and distance for multiple destinations.
Installs: 3 964
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 5
Forks: 10
Open Issues: 3
Requires
- php: >=7.1
- guzzlehttp/guzzle: ^6.2
This package is not auto-updated.
Last update: 2024-11-05 23:32:10 UTC
README
Estimate travel time and distance for multiple destinations.
Requirements
Requires PHP 7.1 or higher.
Installation
The best way to install finalbytes/google-distance-matrix-api is using Composer:
$ composer require finalbytes/google-distance-matrix-api
Getting Started
$distanceMatrix = new GoogleDistanceMatrix('YOUR API KEY'); $distance = $distanceMatrix ->setLanguage('nl-NL') ->addOrigin('51.458428,6.0541768') ->addDestination('48.139212,11.581721') ->addDestination('36.721184,-4.420084') ->sendRequest();
$distanceMatrix = new GoogleDistanceMatrix('YOUR API KEY'); $distance = $distanceMatrix ->addOrigin('Van Bronckhorststraat 94, 5961SM Horst, The Netherlands') ->addDestination('Maistraße 10, 80337 München, Deutschland') ->setMode(GoogleDistanceMatrix::MODE_DRIVING) ->setLanguage('nl-NL') ->setUnits(GoogleDistanceMatrix::UNITS_METRIC) ->setAvoid(GoogleDistanceMatrix::AVOID_FERRIES) ->sendRequest();
For more info, please visit https://developers.google.com/maps/documentation/distance-matrix/