PHPackages                             yidas/google-maps-services - 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. yidas/google-maps-services

ActiveLibrary[API Development](/categories/api)

yidas/google-maps-services
==========================

PHP client library(SDK) for Google Maps API Web Services

1.2.1(2y ago)721.3M—9.1%34[1 issues](https://github.com/yidas/google-maps-services-php/issues)MITPHPPHP &gt;=5.4

Since Aug 18Pushed 2y ago9 watchersCompare

[ Source](https://github.com/yidas/google-maps-services-php)[ Packagist](https://packagist.org/packages/yidas/google-maps-services)[ Docs](https://github.com/yidas/google-maps-services-php)[ RSS](/packages/yidas-google-maps-services/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (1)Versions (11)Used By (0)

 [ ![](https://camo.githubusercontent.com/b0fad14cc895cce0fdd6f80d40f2849a6e27e02408d13a8c92368b52175d544f/68747470733a2f2f636c6f75642e676f6f676c652e636f6d2f696d616765732f6d6170732d706c6174666f726d2f676f6f676c652d6d6170732d6c6f636b75702e737667) ](https://cloud.google.com/maps-platform/)

Google Maps Services *for* PHP
==============================

[](#google-maps-services-for-php)

PHP client library(SDK) for Google Maps API Web Services

[![Latest Stable Version](https://camo.githubusercontent.com/9ea29afb7bb032daa6fc0bf5a40e65957bb3dfb807d4f3672e17d6a3d0530a63/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f676f6f676c652d6d6170732d73657276696365732f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/google-maps-services)[![License](https://camo.githubusercontent.com/42018a5bf0f863d10c0c423a4e4705246ddc26c07e232188a5b6b6c986a30450/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f676f6f676c652d6d6170732d73657276696365732f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/google-maps-services)[![Total Downloads](https://camo.githubusercontent.com/97e4f625dd95b2fde27106743c14f0aa0c83c90155c8bef3a2fe8a22ca885962/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f676f6f676c652d6d6170732d73657276696365732f646f776e6c6f6164733f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/google-maps-services)[![Monthly Downloads](https://camo.githubusercontent.com/def83057ef5e0cad7fd0cc867c901f6f0c8435d75c41fc4d57a5a2573fa43289/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f676f6f676c652d6d6170732d73657276696365732f642f6d6f6e74686c793f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/google-maps-services)

OUTLINE
-------

[](#outline)

- [Demonstration](#demonstration)
- [Description](#description)
- [Requirements](#requirements)
    - [API keys](#api-keys)
- [Installation](#installation)
- [Usage](#usage)
    - [Client](#client)
        - [Google Maps APIs Premium Plan license](#google-maps-apis-premium-plan-license)
        - [Language](#language)
    - [APIs](#apis)

---

DEMONSTRATION
-------------

[](#demonstration)

```
$gmaps = new \yidas\googleMaps\Client(['key'=>'Your API Key']);

// Geocoding an address
$geocodeResult = $gmaps->geocode('Taipei 101, Taipei City, Taiwan 110');

// Look up an address with reverse geocoding
$reverseGeocodeResult = $gmaps->reverseGeocode([25.0339639, 121.5644722]);

// Request directions via public transit
$directionsResult = $gmaps->directions('National Palace Museum', 'Taipei 101', [
    'mode' => "transit",
    'departure_time' => time(),
    ]);
```

---

DESCRIPTION
-----------

[](#description)

The PHP Client for Google Maps Services is a PHP Client library for the following [Google Maps APIs](https://developers.google.com/maps):

- Maps
    - [Elevation API](#elevation-api) ([Google Doc](https://developers.google.com/maps/documentation/elevation/))
- Routes
    - [Routes API](#routes-api) ([Google Doc](https://developers.google.com/maps/documentation/routes))
    - [Roads API](#roads-api) ([Google Doc](https://developers.google.com/maps/documentation/roads))
    - [Directions API](#directions-api) ([Google Doc](https://developers.google.com/maps/documentation/directions/))
    - [Distance Matrix API](#distance-matrix-api) ([Google Doc](https://developers.google.com/maps/documentation/distancematrix/))
- Places
    - \[Places API\] (TBD)
    - [Geocoding API](#geocoding-api) ([Google Doc](https://developers.google.com/maps/documentation/geocoding/))
    - [Geolocation API](#geolocation-api) ([Google Doc](https://developers.google.com/maps/documentation/geolocation/))
    - [Time Zone API](#time-zone-api) ([Google Doc](https://developers.google.com/maps/documentation/timezone/))

---

REQUIREMENTS
------------

[](#requirements)

- PHP 7.0+ or higher

### API keys

[](#api-keys)

Each Google Maps Web Service request requires an API key or client ID. API keys are freely available with a Google Account at . The type of API key you need is a **Server key**.

To get an API key:

1. Visit  and log in with a Google Account.
2. Select one of your existing projects, or create a new project.
3. Enable the Google Maps Services API(s) you plan to use, such as:
    - Directions API
    - Distance Matrix API
    - Geocoding API
    - ...
4. Create a new **Server key**.
5. If you'd like to restrict requests to a specific IP address, do so now.

For guided help, follow the instructions for the \[Directions API\]\[directions-key\]. You only need one API key, but remember to enable all the APIs you need. For even more information, see the guide to \[API keys\]\[apikey\].

**Important:** This key should be kept secret on your server.

---

INSTALLATION
------------

[](#installation)

Run Composer in your project:

```
composer require yidas/google-maps-services

```

Then you could call it after Composer is loaded depended on your PHP framework:

```
require __DIR__ . '/vendor/autoload.php';

use yidas\googleMaps\Client;
```

---

USAGE
-----

[](#usage)

Before using any Google Maps Services, first you need to create a Client with configuration, then use the client to access Google Maps Services.

### Client

[](#client)

Create a Client using [API key]((#api-keys)):

```
$gmaps = new \yidas\googleMaps\Client(['key'=>'Your API Key']);
```

#### Google Maps APIs Premium Plan license

[](#google-maps-apis-premium-plan-license)

If you use [Google Maps APIs Premium Plan license](https://developers.google.com/maps/documentation/directions/get-api-key#client-id) instead of an API key, you could create Client using client ID and client secret (digital signature) for authentication.

```
$gmaps = new \yidas\googleMaps\Client([
    'clientID' => 'Your client ID',
    'clientSecret' => 'Your digital signature'
    ]);
```

#### Language

[](#language)

You could set language for Client for all services:

```
$gmaps = new \yidas\googleMaps\Client(['key'=>'Your API Key', 'language'=>'zh-TW']);
```

> [list of supported languages - Google Maps Platform](https://developers.google.com/maps/faq#languagesupport)

Changing language during execution:

```
$gmaps->setLanguage('zh-TW');
// ...
```

### APIs

[](#apis)

#### Elevation API

[](#elevation-api)

[Elevation API overview | Google for Developers](https://developers.google.com/maps/documentation/elevation/overview)

```
// Get elevation by locations parameter
$elevationResult = $gmaps->elevation([25.0339639, 121.5644722]);
$elevationResult = $gmaps->elevation('25.0339639, 121.5644722');
```

#### Routes API

[](#routes-api)

[Get a route | Google for Developers](https://developers.google.com/maps/documentation/routes/compute_route_directions)

```
$routes = $gmaps->computeRoutes($originArray, $destinationArray, $fullBodyArray, $fieldMask)

// Get the route data between two places simply
$routes = $gmaps->computeRoutes([
        "location" => [
           "latLng" => [
              "latitude" => 37.419734,
              "longitude" => -122.0827784
           ]
        ]
    ],
    [
        "location" => [
           "latLng" => [
              "latitude" => 37.41767,
              "longitude" => -122.079595
           ]
        ]
    ]);

// Get the full route data between two places with full request data
$routes = $gmaps->computeRoutes([...], [...], ["travelMode": "DRIVE", ...], '*');
```

#### Roads API

[](#roads-api)

[Snap to Roads | Google for Developers](https://developers.google.com/maps/documentation/roads/snap)

```
$roads = $gmaps->snapToRoads([[-35.27801,149.12958], [-35.28032,149.12907], [-35.28099,149.12929]]);
```

#### Directions API

[](#directions-api)

[Getting directions | Google for Developers](https://developers.google.com/maps/documentation/directions/get-directions)

```
// Request directions via public transit
$directionsResult = $gmaps->directions('National Palace Museum', 'Taipei 101', [
    'mode' => "transit",
    'departure_time' => time(),
    ]);
```

#### Distance Matrix API

[](#distance-matrix-api)

[Get started with the Distance Matrix API | Google for Developers](https://developers.google.com/maps/documentation/distance-matrix/start)

```
// Get the distance matrix data between two places
$distanceMatrixResult = $gmaps->distanceMatrix('National Palace Museum', 'Taipei 101');

// With Imperial units
$distanceMatrixResult = $gmaps->distanceMatrix('National Palace Museum', 'Taipei 101', [
    'units' => 'imperial',
    ]);
```

#### Geocoding API

[](#geocoding-api)

[Geocoding API overview | Google for Developers](https://developers.google.com/maps/documentation/geocoding/overview)

```
// Geocoding an address
$geocodeResult = $gmaps->geocode('Taipei 101, Taipei City, Taiwan 110');

// Look up an address with reverse geocoding
$reverseGeocodeResult = $gmaps->reverseGeocode([25.0339639, 121.5644722]);
```

#### Geolocation API

[](#geolocation-api)

[Geolocation API overview | Google for Developers](https://developers.google.com/maps/documentation/geolocation/overview)

```
// Simple geolocate
$geolocateResult = $gmaps->geolocate([]);
```

#### Time Zone API

[](#time-zone-api)

[Time Zone API overview | Google for Developers](https://developers.google.com/maps/documentation/timezone/overview)

```
// requests the time zone data for giving location
$timezoneResult = $gmaps->timezone([25.0339639, 121.5644722]);
```

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity55

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 87.9% 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 ~290 days

Recently: every ~228 days

Total

8

Last Release

794d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b30d2b2c0b53aef65fad4af56cd3c7912d3db2b612890c706fe79448717f6aba?d=identicon)[yidas](/maintainers/yidas)

---

Top Contributors

[![yidas](https://avatars.githubusercontent.com/u/12604195?v=4)](https://github.com/yidas "yidas (29 commits)")[![dereuromark](https://avatars.githubusercontent.com/u/39854?v=4)](https://github.com/dereuromark "dereuromark (3 commits)")[![genesiscz](https://avatars.githubusercontent.com/u/1512353?v=4)](https://github.com/genesiscz "genesiscz (1 commits)")

---

Tags

google-maps-api-phpgoogle-maps-sdkgoogle-maps-servicesphpphp-clientphpsdkservicesgoogle maps

### Embed Badge

![Health badge](/badges/yidas-google-maps-services/health.svg)

```
[![Health](https://phpackages.com/badges/yidas-google-maps-services/health.svg)](https://phpackages.com/packages/yidas-google-maps-services)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[hubspot/api-client

Hubspot API client

23914.2M16](/packages/hubspot-api-client)[php-opencloud/openstack

PHP SDK for OpenStack APIs. Supports BlockStorage, Compute, Identity, Images, Networking and Metric Gnocchi

2292.2M24](/packages/php-opencloud-openstack)[mailchimp/transactional

458.9M16](/packages/mailchimp-transactional)[resend/resend-php

Resend PHP library.

574.7M21](/packages/resend-resend-php)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

553.3M7](/packages/checkout-checkout-sdk-php)

PHPackages © 2026

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