A PHP library to make working with the Google Static Maps API a little more friendly.

v1.1.0-beta 2017-07-07 01:47 UTC

This package is auto-updated.

Last update: 2021-02-23 21:50:00 UTC


A PHP library to make working with the Google Static Maps API (and, eventually, others) a little more friendly.

Note: This library is in active development. Refactoring needs to be done, features need added, and the API needs finalized. While the code should be relatively stable, you're cautioned against using this in a production environment.


Composer is the recommended method of installation.

composer require sparkscoding/static-maps

Quick Example

use SparksCoding\StaticMaps\StaticMap;
use SparksCoding\StaticMaps\Components\Map;
use SparksCoding\StaticMaps\Components\Marker;
use SparksCoding\StaticMaps\Components\Feature;
use SparksCoding\StaticMaps\Components\Element;
use SparksCoding\StaticMaps\Components\Path;

// Initialize the map by adding your API key
$staticMap = StaticMap::key('123yOUrAPIkeYGoeSHerE123');

// Set the builder

// Add a map
    Map::create()->center('New York, NY')->zoom(10)

// Add a couple markers
    Marker::location('New York, NY'),
    Marker::location('Brooklyn, NY')

// Style the roads

// Add a path
      'Empire State Building',
      'Webster Hall',
      'The Spotted Pig',
      'The High Line',
      'Empire State Building',

echo '<img src="' . $staticMap->uri() . '">';


NY Static Map


Documentation, including installation instructions and examples, can be found on the Wiki.