PHP code example of frolki1_dev / google-embed-php

1. Go to this page and download the library: Download frolki1_dev/google-embed-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

frolki1_dev / google-embed-php example snippets


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();

// Set a location (street, location, place)
$mapType->setLocation(<string>);

// 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)
$mapType->setZoom(<int>);

// Define the UI language
$mapType->setLanguage(<string>);

// Show the map as a road map
$mapType->useRoadMap();

// Show the map as a satellite map
$mapType->useSatelliteMap();

// Get the source (url)
$mapType->getSource();

// Build a iframe
$mapType->getIFrame();

// How the method setLocation but only the start point
$direction->start(<string>);

// Same how method start but only the destination point
$direction->destination(<string>);

// Add waypoints (Can be multiple called)
$direction->addWayPoint(<string>);

// Calculate the route with the car
$direction->drivingMode();

// Calculate the route with walking
$direction->walkingMode();

// Calculate the route with biking
$direction->bicyclingMode();

// Calclate the route with flying
$direction->flyingMode();

// Avoid tolls
$direction->avoidTolls();

// Avoid Ferry
$direction->avoidFerries();

// Avoid Highway
$dircetion->avoidHighways();

// Use the metric unit
$direction->useMetricUnit();

// Use the imperial unit
$direction->useImperialUnit();
sh
composer