PHPackages                             quexer69/yii2-google-api - 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. quexer69/yii2-google-api

ActiveYii2-extension[API Development](/categories/api)

quexer69/yii2-google-api
========================

A collection of google map api calls, staticmap, geocode, iframe, for google api v3

2.0.3(9y ago)48.7k↓37.5%4BSD-3-ClausePHP

Since Jan 23Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Quexer69/yii2-google-api)[ Packagist](https://packagist.org/packages/quexer69/yii2-google-api)[ RSS](/packages/quexer69-yii2-google-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (7)Used By (0)

Yii2 google api library
=======================

[](#yii2-google-api-library)

---

[![Latest Stable Version](https://camo.githubusercontent.com/662621b7ae01198812f0930e5947f08add3670c0af3736183332a4e8ab08eadd/68747470733a2f2f706f7365722e707567782e6f72672f71756578657236392f796969322d676f6f676c652d6170692f762f737461626c652e737667)](https://packagist.org/packages/quexer69/yii2-google-api) [![Total Downloads](https://camo.githubusercontent.com/d9b28a96399146c1d53ccad6a37a85a4cb33366530714a1b61012f286f791ca6/68747470733a2f2f706f7365722e707567782e6f72672f71756578657236392f796969322d676f6f676c652d6170692f646f776e6c6f6164732e737667)](https://packagist.org/packages/quexer69/yii2-google-api) [![License](https://camo.githubusercontent.com/92d714aa3b4fdffcf66c7421efef57f3938a0dc5d176ce7ff723a43fb9af9815/68747470733a2f2f706f7365722e707567782e6f72672f71756578657236392f796969322d676f6f676c652d6170692f6c6963656e73652e737667)](https://packagist.org/packages/quexer69/yii2-google-api)

A collection of google map api calls, staticmap, geocode, iframe map

...for Google API v3, PHP &gt;= 5.4.0, Yii 2.0.\*

Installation
------------

[](#installation)

The preferred way to install this component is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist quexer69/yii2-google-api "2.0.*"

```

or add

```
"quexer69/yii2-google-api": "2.0.*"

```

to the require section of your `composer.json` file.

Configuration
-------------

[](#configuration)

in your app and/or console configuration file, add these

```
'components' => [

    // Google Maps Image and Geocode API settings for \Yii::$app->googleApi component
    'googleApi'   => [
            'class'             => 'quexer\googleapi\GoogleApiLibrary',

            // API Keys !!!
            'staticmap_api_key' => '***************************************',
            'geocode_api_key'   => '***************************************',

            // Set basePath
            'webroot'           => '@webroot',

            // Image path and map iframe settings
            'map_image_path'    => '/images/google_map',
            'map_type'          => 'terrain',
            'map_size'          => '520x350',
            'map_sensor'        => false,
            'map_zoom'          => 9,
            'map_scale'         => 1,
            'map_marker_color'  => 'red',
            'map_iframe_width'  => '100%', // %, px, em
            'map_iframe_height' => '500px',  // %, px, em
            'map_language'        => 'de',

            // Debug
            'quiet'             => false
    ],
    ...
],
```

Public Methods
--------------

[](#public-methods)

```
\Yii::$app->googleApi->renderMapIframe($address, $latlng, $iFrameWidth, $iFrameHeight)

\Yii::$app->googleApi->createImage($address, $latlng, $setMarker)

\Yii::$app->googleApi->getGeoCodeObject($address, $latlng)

\Yii::$app->googleApi->getDistance($start, $finish, $unit)

\Yii::$app->googleApi->getBounds($address)
```

Usage
-----

[](#usage)

Once the component is installed, simply use it in your code by:

```
// Use $address OR $latlng
$address 	          = '70180 Stuttgart, Germany';
$latlng 	          = '48.7632145,9.174027';
```

**Create a Google map image**

```
$relFilePath          = \Yii::$app->googleApi->createImage($address, null, true);
```

**To simply get the Google geocode object**

```
$relFilePath          = \Yii::$app->googleApi->getGeoCodeObject(null, $latlng);
```

**Render a Google map iframe**

```
$iframeMarkup         = \Yii::$app->googleApi->renderMapIframe(null, $latlng);
```

**Calculate Distance between two geo points**

```
$latlng_origin	      = ['48.7632145','9.174027'];
$latlng_destination	  = ['48.4525334','9.468254'];
$unit		          = 'miles'; // 'miles' or 'km'

$floatDistance        = \Yii::$app->googleApi->getDistance($latlng_origin, $latlng_destination, $unit);
```

See also
--------

[](#see-also)

... a more extensive variant

- [2amigos/yii2-google-maps-library](https://github.com/2amigos/yii2-google-maps-library)

Resources
---------

[](#resources)

- [Google Maps API Reference](https://developers.google.com/maps/documentation/)
- [Project on GitHub](Quexer69/yii2-google-api)
- [Quexer69 Packagist Profile](https://packagist.org/packages/Quexer69/)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~140 days

Recently: every ~175 days

Total

6

Last Release

3434d ago

Major Versions

1.1.0 → 2.0.02015-01-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/3c972f0cf344d2cf84ae688179ca030c79265590bcf67b6372fc0edce95043dc?d=identicon)[Quexer69](/maintainers/Quexer69)

---

Top Contributors

[![Quexer69](https://avatars.githubusercontent.com/u/3859353?v=4)](https://github.com/Quexer69 "Quexer69 (1 commits)")[![totojack](https://avatars.githubusercontent.com/u/1204877?v=4)](https://github.com/totojack "totojack (1 commits)")

---

Tags

geocodergoogle-apistaticmapyii2apigoogleyii2extensiongoogle map

### Embed Badge

![Health badge](/badges/quexer69-yii2-google-api/health.svg)

```
[![Health](https://phpackages.com/badges/quexer69-yii2-google-api/health.svg)](https://phpackages.com/packages/quexer69-yii2-google-api)
```

###  Alternatives

[dotzero/yii2-amocrm

Расширение для Yii Framework 2 реализующее клиент для работы с API amoCRM

1639.7k](/packages/dotzero-yii2-amocrm)[skeeks/yii2-google-api

Component for work with google api based on google/apiclient

1243.1k1](/packages/skeeks-yii2-google-api)[mikemadisonweb/yii2-elasticsearch

Yii2 extension for integration with Elasticsearch version 5.0 and above.

153.9k](/packages/mikemadisonweb-yii2-elasticsearch)[apexwire/yii2-restclient

Tools to use API as ActiveRecord for Yii2

143.5k](/packages/apexwire-yii2-restclient)

PHPackages © 2026

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