PHPackages                             panix/lib-google-maps - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. panix/lib-google-maps

ActivePixelion-component[Utility &amp; Helpers](/categories/utility)

panix/lib-google-maps
=====================

Google Maps API library for PIXELION CMS

1.0.0(5y ago)0249MITPHP

Since Feb 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/andrtechno/lib-google-maps)[ Packagist](https://packagist.org/packages/panix/lib-google-maps)[ RSS](/packages/panix-lib-google-maps/feed)WikiDiscussions master Synced 2w ago

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

lib-google-maps
===============

[](#lib-google-maps)

Google Maps API library for Yii2

[![Latest Stable Version](https://camo.githubusercontent.com/226054734a4ccd0777da8614d35b4a93de7148d6cb9d021d38a7c508ded71677/68747470733a2f2f706f7365722e707567782e6f72672f70616e69782f6c69622d676f6f676c652d6d6170732f762f737461626c652e737667)](https://packagist.org/packages/panix/lib-google-maps) [![Total Downloads](https://camo.githubusercontent.com/0759c11f80dffe482206bc02d7a86c7bb37be52bcda7e746c95f07db9f3f09b7/68747470733a2f2f706f7365722e707567782e6f72672f70616e69782f6c69622d676f6f676c652d6d6170732f646f776e6c6f6164732e737667)](https://packagist.org/packages/panix/lib-google-maps) [![Latest Unstable Version](https://camo.githubusercontent.com/37978660c546a63159fbe2818ed949bc5dfbb3872d1b528e9ae9768257e76dd8/68747470733a2f2f706f7365722e707567782e6f72672f70616e69782f6c69622d676f6f676c652d6d6170732f762f756e737461626c652e737667)](https://packagist.org/packages/panix/lib-google-maps) [![License](https://camo.githubusercontent.com/8faf042e1d1ce1a3d159fba89c5ac95f62733ea492a4229116716e932fad0cc0/68747470733a2f2f706f7365722e707567782e6f72672f70616e69782f6c69622d676f6f676c652d6d6170732f6c6963656e73652e737667)](https://packagist.org/packages/panix/lib-google-maps)

Introduction
------------

[](#introduction)

Even though we already created an extension to display maps that are away from Google's policies and works with [LeafLetJs](http://leafletjs.com/ "http://leafletjs.com/") library, we still received requests to have [EGMap extension for Yii1](http://www.yiiframework.com/extension/egmap) updated. So we thought that we should update this library and make it work with Yii2 if we were to update it. Thats the reason behind the creation of this extension.

Nevertheless, it is important to note that we didn't have time (**yet**) to write any good documentation about it. We wanted to publish it already, just in case somebody working with Yii2 was missing the EGMap library for its projects, and wishes to update us with its tests and bug findings.

The github repository will keep being updated, and documentation well written for its usage. So please, do not be impatient. If you do, any help will be highly appreciated.

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

[](#installation)

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

Either run

```
php composer require "panix/lib-google-maps" "*"

```

or add

```
"panix/lib-google-maps" : "*"
```

to the require section of your application's `composer.json` file.

Usage
-----

[](#usage)

Even though there will be plenty of examples on how to use it, here is one that will provide you with a glimpse of its usage:

Service
-------

[](#service)

```
use panix\lib\google\maps\LatLng;
use panix\lib\google\maps\services\DirectionsWayPoint;
use panix\lib\google\maps\services\TravelMode;
use panix\lib\google\maps\overlays\PolylineOptions;
use panix\lib\google\maps\services\DirectionsRenderer;
use panix\lib\google\maps\services\DirectionsService;
use panix\lib\google\maps\overlays\InfoWindow;
use panix\lib\google\maps\overlays\Marker;
use panix\lib\google\maps\Map;
use panix\lib\google\maps\services\DirectionsRequest;
use panix\lib\google\maps\overlays\Polygon;
use panix\lib\google\maps\layers\BicyclingLayer;

$coord = new LatLng(['lat' => 39.720089311812094, 'lng' => 2.91165944519042]);
$map = new Map([
    'center' => $coord,
    'zoom' => 14,
]);

// lets use the directions renderer
$home = new LatLng(['lat' => 39.720991014764536, 'lng' => 2.911801719665541]);
$school = new LatLng(['lat' => 39.719456079114956, 'lng' => 2.8979293346405166]);
$santo_domingo = new LatLng(['lat' => 39.72118906848983, 'lng' => 2.907628202438368]);

// setup just one waypoint (Google allows a max of 8)
$waypoints = [
    new DirectionsWayPoint(['location' => $santo_domingo])
];

$directionsRequest = new DirectionsRequest([
    'origin' => $home,
    'destination' => $school,
    'waypoints' => $waypoints,
    'travelMode' => TravelMode::DRIVING
]);

// Lets configure the polyline that renders the direction
$polylineOptions = new PolylineOptions([
    'strokeColor' => '#FFAA00',
    'draggable' => true
]);

// Now the renderer
$directionsRenderer = new DirectionsRenderer([
    'map' => $map->getName(),
    'polylineOptions' => $polylineOptions
]);

// Finally the directions service
$directionsService = new DirectionsService([
    'directionsRenderer' => $directionsRenderer,
    'directionsRequest' => $directionsRequest
]);

// Thats it, append the resulting script to the map
$map->appendScript($directionsService->getJs());

// Lets add a marker now
$marker = new Marker([
    'position' => $coord,
    'title' => 'My Home Town',
]);

// Provide a shared InfoWindow to the marker
$marker->attachInfoWindow(
    new InfoWindow([
        'content' => 'This is my super cool content'
    ])
);

// Add marker to the map
$map->addOverlay($marker);

// Now lets write a polygon
$coords = [
    new LatLng(['lat' => 25.774252, 'lng' => -80.190262]),
    new LatLng(['lat' => 18.466465, 'lng' => -66.118292]),
    new LatLng(['lat' => 32.321384, 'lng' => -64.75737]),
    new LatLng(['lat' => 25.774252, 'lng' => -80.190262])
];

$polygon = new Polygon([
    'paths' => $coords
]);

// Add a shared info window
$polygon->attachInfoWindow(new InfoWindow([
        'content' => 'This is my super cool Polygon'
    ]));

// Add it now to the map
$map->addOverlay($polygon);

// Lets show the BicyclingLayer :)
$bikeLayer = new BicyclingLayer(['map' => $map->getName()]);

// Append its resulting script
$map->appendScript($bikeLayer->getJs());

// Display the map -finally :)
echo $map->display();
```

Client
------

[](#client)

```
use panix\lib\google\maps\services\DirectionsClient;

$direction = new DirectionsClient([
    'params' => [
        'language' => Yii::$app->language,
        'origin' => 'street from',
        'destination' => 'street to'
    ]
]);

$data = $direction->lookup(); //get data from google.maps API
```

This extension has also a plugin architecture that allow us to enhance it, so expect plugins to be developed in near future too.

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

[](#configuration)

To configure the Google Map key or other options like language, version, library, use the [Asset Bundle customization](http://www.yiiframework.com/doc-2.0/guide-structure-assets.html#customizing-asset-bundles) feature.

```
'components' => [
    'assetManager' => [
        'bundles' => [
            'panix\lib\google\maps\MapAsset' => [
                'options' => [
                    'key' => 'this_is_my_key',
                    'language' => 'id',
                    'version' => '3.1.18'
                ]
            ]
        ]
    ],
],
```

To get key, please visit

Resources
---------

[](#resources)

- [Google Maps API Reference](https://developers.google.com/maps/documentation/)
- [GitHub](https://github.com/andrtechno/lib-google-maps)
- [Panix Packagist Profile](https://packagist.org/packages/panix/)

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

1975d ago

### Community

Maintainers

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

---

Top Contributors

[![andrtechno](https://avatars.githubusercontent.com/u/6948026?v=4)](https://github.com/andrtechno "andrtechno (15 commits)")

---

Tags

googlelibraryextensionmapspixelion-cms

### Embed Badge

![Health badge](/badges/panix-lib-google-maps/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[fedemotta/yii2-widget-datatables

DataTables widget for Yii2

34182.9k1](/packages/fedemotta-yii2-widget-datatables)

PHPackages © 2026

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