Use the Embed API of Google Maps with PHP
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Google Embed PHP

Build Status codecov GitHub issues Packagist Packagist Pre Release GitHub license

Use the Embed API of Google Maps with PHP


To use this library you must have at least PHP 7.0.


The Google Embed can be installed with Composer. Run this command:

composer require frolki1_dev/google-embed-php


To use this library you must have an api key. You can get the free version because you can use the embed api for free.

use Frolki1_Dev\GoogleEmbedMap;

$maps = new GoogleEmbedMap(<Add here your api key>);

// Create a direction map
$direction = $maps->createDirectionsMap();

// Create a place map
$place = $maps->createPlaceMap();

// Crsate a search map
$search = $maps->createSearchMap();

// Create a view map
$view = $maps->createViewMap();


You have the following options in every map type:

// Set a location (street, location, place)

// Set the center of the view (latitude and longitude)
$mapType->setCenter(<float>, <float>);

// Set the zoom factor (0 - 21, 0 = Whole world, 21 = A single building)

// Define the UI language

// Show the map as a road map

// Show the map as a satellite map

// Get the source (url)

// Build a iframe

Direction options

The direction map has also the options and the following methods:

// How the method setLocation but only the start point

// Same how method start but only the destination point

// Add waypoints (Can be multiple called)

// Calculate the route with the car

// Calculate the route with walking

// Calculate the route with biking

// Calclate the route with flying

// Avoid tolls

// Avoid Ferry

// Avoid Highway

// Use the metric unit

// Use the imperial unit


This library is an open source project and is licensed under the MIT license.