2017 © Pedro Peláez
 

library static-maps

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

image

sparkscoding/static-maps

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

  • Friday, July 7, 2017
  • by SparksCoding
  • Repository
  • 2 Watchers
  • 4 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 20 % Grown

The README.md

Static Maps

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

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., (*2)

Installation

Composer is the recommended method of installation., (*3)

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
$staticMap->setBuilder(
    '\SparksCoding\StaticMaps\Builders\GoogleStaticMapBuilder'
);

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

// Add a couple markers
$staticMap->addMarkers(
    Marker::location('New York, NY'),
    Marker::location('Brooklyn, NY')
);

// Style the roads
$staticMap->addStyles(
    Feature::name('road')->elements(
        Element::name('geometry')->color('blue')
    )
);

// Add a path
$staticMap->addPath(
  Path::points([
      'Empire State Building',
      'Webster Hall',
      'The Spotted Pig',
      'The High Line',
      'Empire State Building',
  ])->color('0x000000ff')->fillcolor('0xFFFF0033')->weight(2)
);

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

Output:, (*4)

NY Static Map, (*5)

Documentation

Documentation, including installation instructions and examples, can be found on the Wiki., (*6)

The Versions

07/07 2017

dev-master

9999999-dev

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

  Sources   Download

MIT

by Matt Sparks

google maps maps map static maps google static map api

07/07 2017

v1.1.0-beta

1.1.0.0-beta

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

  Sources   Download

MIT

by Matt Sparks

google maps maps map static maps google static map api

05/07 2017

v1.0.0-beta

1.0.0.0-beta

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

  Sources   Download

MIT

by Matt Sparks

google maps maps map static maps google static map api