We are going to deploy the new yiiframework.com website on March 23, 2018 from 8:00 to 12:00 UTC.
Website and Yii documentation will not be available in this time frame. Check the news for more details.


The easiest way to add and style google map in your application.

Add google map in your application and change the color scheme to match your theme. This is the easiest way to implement google map. The extension is just a wrapper for google's latest javascript map API to make it more easier.


Yii 1.1 or above

PHP 5 above

Google Map API key. If you dont have API key, you can obtain it from here.


Extract the folder into protected/extension/easymap.

Insert following widget in view for simple map integration:

$this->widget('ext.easymap.EasyMap', array(
    'key' => '', /*Insert your developer API key for google map*/
    'id' => 'newmap', /*This is the id of the map wrapper div*/
    'latitude' => '22.572646000000000000', /*Place Latitude*/
    'longitude' => '88.363894999999950000', /*Place Longitude*/
    'zoom' => '10', /*Zoom level. Default is 7*/
    'width' => '400', /*Map height*/
    'height' => '200', /*Map width*/
    'markertitle' => '', /*Title of the place marker*/

Following is the example of styled map:

$this->widget('ext.easymap.EasyMap', array(
    'key' => '',
    'id' => 'newmap',
    'latitude' => '22.572646000000000000',
    'longitude' => '88.363894999999950000',
    'zoom' => '10',
    'width' => '400',
    'height' => '200',
    'markertitle' => '',
    'style' => array(
                    'stylers'=>   array(array(
                         'hue'=>'#00ffe6', /*an RGB hex string*/
                         'saturation'=>'20', /*a floating point value between -100 and 100*/
                    'featureType'=>'road', /*road, road.local, landscape, landscape.natural*/
                    'elementType'=>'geometry', /*all, geometry, geometry.fill, geometry.stroke, labels, labels.icon, labels.text, labels.text.fill,     labels.text.stroke*/
                    'stylers'=>   array(array(
                         'lightness'=>'100', /*a floating point value between -100 and 100*/
                         'visibility'=>'simplified', /*on, off, or simplified*/
                       'stylers'=>   array(array(

Here is the full list of option available for stylers array:

'stylers'=>   array(array(
                   'hue'=>'', /*an RGB hex string*/
           'saturation'=>'', /*a floating point value between -100 and 100*/
               'lightness'=>'', /*a floating point value between -100 and 100*/
               'visibility'=>'', /*on, off, or simplified*/
                   'gamma'=>'', /*a floating point value between 0.01 and 10.0, where 1.0 applies no correction*/
                   'inverse-lightness'=>'', /*(if true) simply inverts the existing lightness*/
                   'color'=>'', /*(an RGB hex string) sets the color of the feature*/
                   'weight'=>'', /*an integer value, greater than or equal to zero*/

For more style option visit this google map API site.

Total 6 comments

#15798 report it
sidewinder at 2013/12/18 07:14am
Small sugestion

Nice extension. Simple and get its job done. One small suggestion I have is moving units from line 22 to relevant variables in lines 10 and 11. That way, users can easily choose units they want to use.

lines 10 and 11

public $width = '300px';
public $height = '250px';

line 22

echo "<div id='".$this->id."' style='width:".$this->width."; height:".$this->height.";'></div>";
#13699 report it
compugator at 2013/06/18 09:26am
Zoom Slider issue

I just dropped your first widget above into my page.

I need to check this link out when I get home.

It may be the root of my problem.

#13695 report it
Robiul at 2013/06/18 03:24am
Zoom Slider issue

hey compugator, can you post your code so i can look into the issue, thanks.

#13693 report it
compugator at 2013/06/17 11:53pm
Zoom Slider Problem

Any idea on why my zoom slider shows up all messed up on the map?

#13508 report it
Robiul at 2013/06/02 11:50pm
file name issue resolved

hi JFReyes, thanks for your comment, i have fixed the filename issue.

#13498 report it
JFReyes at 2013/06/01 09:43am
Please fix filename spelling

The distributed file is called easymap.php (all lower case) but the usage instruction says EasyMap.php (camelcase). As is, it will cause a "file not found" error. Otherwise it works great. Thanks!

Leave a comment

Please to leave your comment.

Create extension