cirovargas / google-distance-matrix
Google distance matrix API - Estimate travel time and distance for multiple origins and destinations.
Installs: 14 657
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 1
Forks: 13
Open Issues: 2
pkg:composer/cirovargas/google-distance-matrix
Requires
- php: >=7.0
- guzzlehttp/guzzle: ^6.2
This package is not auto-updated.
Last update: 2026-01-18 09:19:21 UTC
README
Estimate travel time and distance for multiple destinations.
Requirements
Requires PHP 7.0 or higher.
Installation
The best way to install cirovargas/google-distance-matrix is using Composer:
$ composer require cirovargas/google-distance-matrix
Getting Started
$distanceMatrix = new GoogleDistanceMatrix('YOUR API KEY'); $distance = $distanceMatrix->setLanguage('cs') ->addOrigin('49.950096, 14.668544') ->addOrigin('49.950096, 15.668544') ->addDestination('50.031817, 14.490880') ->addDestination('51.031817, 14.490880') ->sendRequest();
$distanceMatrix = new GoogleDistanceMatrix('YOUR API KEY'); $distance = $distanceMatrix ->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-US') ->setUnits(GoogleDistanceMatrix::UNITS_IMPERIAL) ->setAvoid(GoogleDistanceMatrix::AVOID_HIGHWAYS) ->sendRequest();
For more info, please visit https://developers.google.com/maps/documentation/distance-matrix/