Skip to content
Easy - peasy - maps for Laravel
Branch: master
Clone or download
Latest commit 8d2beae Aug 29, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Update Map.php Mar 28, 2018
tests Add Laravel 5.8 compatibility for tests also Mar 25, 2019
.gitattributes Initial commit Oct 14, 2017
.gitignore WIP Apr 19, 2019
.scrutinizer.yml Initial commit Oct 14, 2017
.travis.yml Update travis config. Aug 29, 2019 Add Laravel 5.7 compatibility Oct 5, 2018
LICENSE Initial commit Oct 14, 2017 Add Laravel 5.6 compatibility Feb 10, 2018
composer.json Add Laravel 6.0 compatibility. Aug 29, 2019
phpunit.xml Update phpunit.xml Apr 19, 2019


Join the chat at Travis SensioLabs Insight Scrutinizer Coveralls GitHub (pre-)release Packagist GitHub license


  • PHP >= 7.1.3
  • Laravel >= 5.5

This package is the continuation of GeneaLabs/Phpgmaps. The move to the more appropriately-named package namespace is in preparation for a complete rewrite of the package, optimizing it for Laravel.


This repo aims to keep appitventures/phpgmaps alive, hopefully filling in temporarily until they make their repo available again, or else continuing its maintenance going forward and keeping it working with future versions of Laravel.

Currently only Laravel 5.* is supported.


Add the repo to composer.json under this new namespace:

composer require genealabs/laravel-maps

Add an environment variable with your Google Maps API Key in your .env file:


Lastly, add the following entry to your \config\services.php config file:

    'google' => [
        'maps' => [
            'api-key' => env('GOOGLE_MAPS_API_KEY'),


The following code will prompt the user for access to their geolocation and then creates a map centered on their lat/lng

Route::get('/', function(){
    $config = array();
    $config['center'] = 'auto';
    $config['onboundschanged'] = 'if (!centreGot) {
            var mapCentre = map.getCenter();
                position: new google.maps.LatLng(, mapCentre.lng())
        centreGot = true;';


    // set up the marker ready for positioning
    // once we know the users location
    $marker = array();

    $map = app('map')->create_map();
    echo "<html><head><script type="text/javascript">var centreGot = false;</script>".$map['js']."</head><body>".$map['html']."</body></html>";

More Examples

BIOINSTALL has a great website showing how to do all the things with the class. No reason to reinvent the wheel, so here it is. The only thing to note is that $this->googlemaps is now either the facade Map:: or the app variable app('map').

You can’t perform that action at this time.