Skip to content

Installation

Matt Sparks edited this page Jul 4, 2017 · 4 revisions

Via Composer

Composer is the recommended method for installation.

composer require sparkscoding/static-maps

Once installed, include the autoloader (if it's not already included) and pull in the components you need. At a minimum you need the main StaticMap class and the Map component.

include '../vendor/autoload.php';

use SparksCoding\StaticMaps\StaticMap;
use SparksCoding\StaticMaps\Components\Map;

// Add your api key
$staticMap = StaticMap::key('your_api_key');

// Set the builder
$staticMap->setBuilder('\SparksCoding\StaticMaps\Builders\GoogleStaticMapBuilder');

// Add the map
$staticMap->setMap(
    Map::create()->center('Lexington, KY')->zoom(13)
);

Additional examples can be found on the Examples page.

Clone this wiki locally