PHPackages                             opencleancode/php-google-matrix-distance-api-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. opencleancode/php-google-matrix-distance-api-client

ActiveLibrary[API Development](/categories/api)

opencleancode/php-google-matrix-distance-api-client
===================================================

Google matrix api for php implementation

1.3(2y ago)018.1kMITPHPPHP &gt;=8.0

Since Nov 1Pushed 2y agoCompare

[ Source](https://github.com/opencleancode/maps-distance-api-php-client)[ Packagist](https://packagist.org/packages/opencleancode/php-google-matrix-distance-api-client)[ RSS](/packages/opencleancode-php-google-matrix-distance-api-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

PHP Client for Google Distance Matrix API
=========================================

[](#php-client-for-google-distance-matrix-api)

The Google Distance Matrix API is a service that provides travel distance and time for a matrix of origins and destinations. The information returned is based on the recommended route between start and end points, as calculated by the Google Maps API, and consists of rows containing duration and distance values for each pair.

Please refer to Google Distance Matrix API documentation for further details on request parameters and response format.

###### Installation

[](#installation)

`composer require opencleancode/php-google-matrix-distance-api-client `

###### Basic Usage

[](#basic-usage)

```
   $distanceMatrix = new DistanceMatrix();

    $distanceMatrix->setOrigins('Vancouver, BC, Canada | Seattle, État de Washington, États-Unis')
        ->setDestinations('San Francisco, Californie | États-Unis,Victoria, BC, Canada')
        ->setUnits(Unit::IMPERIAL);

    $matrixClient = new GoogleMapsMatrixApiClient(self::API_KEY);
    $result = $matrixClient->request($distanceMatrix)->getResults();

            $result->getStatus();
            $result->getDestinationAddresses();
            $result->getOriginAddresses();

            /** @var Item $item */
            foreach ($result->getItems() as $item){

                    $item->getStatus();
                    $item->getDestinationAddress();
                    $item->getOriginAddress();
                    $item->getDistance()->getValue();
                    $item->getDistance()->getUnitValue();
                    $item->getDuration()->getValue();
                    $item->getDuration()->getUnitValue();
            }

```

###### Request Parameters Options

[](#request-parameters-options)

FieldTypeDescriptionRequiredoriginsstringOrigin Point Coordinate or Place NameTruedestinationsstringDestinations Point Coordinate or Place NameTruemodestringTravel Mode (driving,walking etc.)FalselanguagestringResponse LanguageFalseunitstringDistance unitFalsetrafficModelstringTraffic Type (best\_guess,pessimistic)False###### Response Fields

[](#response-fields)

FieldTypeDescriptionstatusstringApi response status type OK , FAILED etc.originAddressesarrayOrigin Addresses listdestinationsAddressesarrayDestinations Addresses listitemsarrayResponse Items###### Response Item Fields

[](#response-item-fields)

FieldTypeDescriptiondistanceobjectDistance unformatted value and unit valuedurationobjectDurations unformatted value and unit valuestatusstringStatus OK , FAILEDoriginAddressstringSingle Origin AddressdestinationAddressstringSingle Destination Address###### Example Response

[](#example-response)

[![example response](https://camo.githubusercontent.com/6501b5688bfa899458eed9a0f62dfbbd5958ce7262b343b879d07e509b449859/68747470733a2f2f696d672e74656368706f77657275702e6f72672f3230303532392f73637265656e2d73686f742d323032302d30352d33302d61742d30302d32392d35392e706e67)](https://camo.githubusercontent.com/6501b5688bfa899458eed9a0f62dfbbd5958ce7262b343b879d07e509b449859/68747470733a2f2f696d672e74656368706f77657275702e6f72672f3230303532392f73637265656e2d73686f742d323032302d30352d33302d61742d30302d32392d35392e706e67)

###### TODO

[](#todo)

- Exception Response Structure must be created

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

4

Last Release

920d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/822fa12937ee7abdbfb53123cec978c32d2d1eef4df0ef632098dffcb190cfb7?d=identicon)[opencleancode](/maintainers/opencleancode)

---

Top Contributors

[![xarakiry](https://avatars.githubusercontent.com/u/4180510?v=4)](https://github.com/xarakiry "xarakiry (7 commits)")[![olucvolkan](https://avatars.githubusercontent.com/u/13987389?v=4)](https://github.com/olucvolkan "olucvolkan (3 commits)")

---

Tags

googledistancematrix apimaps-api

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/opencleancode-php-google-matrix-distance-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/opencleancode-php-google-matrix-distance-api-client/health.svg)](https://phpackages.com/packages/opencleancode-php-google-matrix-distance-api-client)
```

###  Alternatives

[google/apiclient

Client library for Google APIs

9.8k191.4M997](/packages/google-apiclient)[google/apiclient-services

Client library for Google APIs

1.3k180.5M51](/packages/google-apiclient-services)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)[revolution/laravel-google-sheets

Google Sheets API v4

4483.1M6](/packages/revolution-laravel-google-sheets)[pulkitjalan/google-apiclient

Google api php client wrapper with Cloud Platform and Laravel support

2582.9M5](/packages/pulkitjalan-google-apiclient)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
