0

Yii2 – Google Maps API

Google Maps API library for Yii2. It is easy access to Google API functions from Yii2 application. This extension allows to Google Maps API JavaScript library in your views.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require "2amigos/yii2-google-maps-library" "*"

or add

"2amigos/yii2-google-maps-library" : "*"

to the require section of your composer.json file.

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:

First configure the Google Map key or other options like language, version, library, use the Asset Bundle customization feature.

 

Next use namespace of the classes.

 

Simple Map

Use Simple Yii2 – Google’s native web APIs for visualizing maps.

Yii2 - Google Map API - Simpe Map

 

Map with a Marker

A marker identifies a location on a map.

Yii2 - Google Map API - Map with a Marker

 

Map with a Directions

The Google Maps API Directions Service which receives direction requests and returns an efficient path.

Yii2 - Google Map API - Map with a Direction

 

Waypoints in Directions

The Google Maps API Directions Service object to fetch directions for a route including waypoints.

Yii2 - Google Map API - Waypoints in Direction

 

Simple Polylines

The Polyline class defines a linear overlay of connected line segments on the map. The Polyline constructor takes a set of PolylineOptions specifying the LatLng coordinates of the line and a set of styles to adjust the polyline’s visual behavior.

Yii2 - Google Map API - Simple Polylines

 

Simple Polygon

A polygon represents an area enclosed by a closed path (or loop), which is defined by a series of coordinates. Polygon objects are similar to Polyline objects in that they consist of a series of coordinates in an ordered sequence.

Yii2 - Google Map API - Simple Polygon

 

 

Prakash S

Prakash S

I would like to introduce myself as a Software professional opting for the career in software industry. I'm Prakash S, a MCA graduate and trained as industry level practice for Software technology. Basically I am a PHP Developer but now days exploring more in HTML5, CSS, AngularJS and jQuery libraries.