mastani / laravel-google-static-map
Laravel Google Static Map Generator
Installs: 893 646
Dependents: 5
Suggesters: 0
Security: 0
Stars: 40
Watchers: 4
Forks: 12
Open Issues: 1
Requires
- illuminate/contracts: 5.*|6.*|7.*|8.*|^9.0|^10.0|^11.0
- illuminate/support: 5.*|6.*|7.*|8.*|^9.0|^10.0|^11.0
README
Generate static map using Google Map API in Laravel.
Installation in Laravel 5.5 and up
$ composer require mastani/laravel-google-static-map
The package will automatically register itself.
Installation in Laravel 5.4
$ composer require mastani/laravel-google-static-map
Next up, the service provider must be registered:
// config/app.php 'providers' => [ ... Mastani\GoogleStaticMap\GoogleStaticMapServiceProvider::class, ];
Installation without Laravel
Another way is install the component through composer.
Either run
$ composer require mastani/laravel-google-static-map
or add
"mastani/laravel-google-static-map": "dev-master"
to the require section of your composer.json.
Usage
$map = new \Mastani\GoogleStaticMap\GoogleStaticMap('Place google map API key or leave it empty'); $url = $map->setCenter('Tehran') ->setMapType(\Mastani\GoogleStaticMap\MapType::RoadMap) ->setZoom(14) ->setSize(600, 600) ->setFormat(\Mastani\GoogleStaticMap\Format::JPG) ->addMarker('Tehran', '1', 'red', \Mastani\GoogleStaticMap\Size::Small) ->addMarkerLatLng(35.6907488, 51.3919293, '1', 'red', \Mastani\GoogleStaticMap\Size::Small) ->make(); // Return url contain map address. // or ->download($path); // Download map image
Function
License
The MIT License (MIT). Please see License File for more information.