├── .gitattributes ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── composer.json ├── phpunit.xml └── src └── FarhanWazir └── GoogleMaps ├── Containers └── isInsidePolygon.php ├── Facades └── GMapsFacade.php ├── GMaps.php ├── GMapsServiceProvider.php ├── Publishes ├── config │ └── googlemaps.php ├── database │ └── migrations │ │ └── create_gmaps_geocache_table.php └── public │ └── libs │ └── FarhanWazir │ └── GMaps │ └── markerclusterer.js └── example ├── Controllers └── MapController.php ├── Routes └── routes.php └── Views └── map.blade.php /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | composer.phar 3 | composer.lock 4 | .DS_Store 5 | /.idea 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 5.6 5 | - 5.7 6 | - 5.8 7 | - 5.9 8 | - hhvm 9 | 10 | before_script: 11 | - composer self-update 12 | - composer install --prefer-source --no-interaction --dev 13 | 14 | script: phpunit 15 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## 1.2.5 - 1.5.0: 03 May 2016 4 | ### Added 5 | - Examples create 6 | - Configuration 7 | 8 | ### Changed 9 | - Class modifications 10 | - Installation instructions and usage ReadMe. 11 | 12 | ## 1.8.x - 2.1.1: 31 July 2016 13 | ### Added 14 | - Geofence 15 | - Database 16 | 17 | ### Changed 18 | - Added Geofence for server side check 19 | - Geo cache fixed 20 | - Added usage of geo-fence -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Creative Ideator. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Laravel Google Maps 2 | [](http://phppackages.org/p/farhanwazir/laravelgooglemaps) 3 | [](https://packagist.org/packages/farhanwazir/laravelgooglemaps) 4 | [](https://packagist.org/packages/farhanwazir/laravelgooglemaps) 5 | [](https://packagist.org/packages/farhanwazir/laravelgooglemaps) 6 | [](https://packagist.org/packages/farhanwazir/laravelgooglemaps) 7 | 8 | This repo aims to use google map features in laravel 5.x. It is easy to use and flexible, you can just install this package and enjoy google map in your website and/or applications. 9 | 10 | 11 | ## Features 12 | 1. Localizing 13 | 2. Map Types 14 | 3. Custom Style 15 | 4. Makers 16 | 5. Info Window 17 | 6. Shapes 18 | 7. Symbols 19 | 8. Overlays 20 | 9. KML and GeoRSS 21 | 10. Traffic and Bicycling Layer 22 | 11. Geocoding Caches 23 | 12. Controls 24 | 13. Street View 25 | 14. Events 26 | 15. Reverse Geocoding 27 | 16. Travel Moding 28 | 17. Proxy 29 | 30 | ### Services & Libraries 31 | 1. Directions 32 | 2. Geocoding 33 | 3. Geometry 34 | 4. Drawing 35 | 5. Places 36 | 6. Autocomplete 37 | 7. Adsense 38 | 8. Geofence (For now only server side geofence available) 39 | 40 | ## Installation 41 | Add in composer.json 42 | ``` 43 | "require": { 44 | "farhanwazir/laravelgooglemaps": "^2.3" 45 | ---- 46 | } 47 | ``` 48 | Then 49 | ``` 50 | composer update 51 | ``` 52 | Or install via composer cli 53 | ``` 54 | composer require farhanwazir/laravelgooglemaps 55 | ``` 56 | 57 | Add service provider `config/app.php` 58 | ```php 59 | FarhanWazir\GoogleMaps\GMapsServiceProvider::class, 60 | ``` 61 | 62 | And finally add in the alias section `config/app.php` 63 | ```php 64 | 'GMaps' => FarhanWazir\GoogleMaps\Facades\GMapsFacade::class, 65 | ``` 66 | 67 | Now publish configuration file 68 | ```php 69 | php artisan vendor:publish --provider="FarhanWazir\GoogleMaps\GMapsServiceProvider" 70 | ``` 71 | 72 | ##Usage 73 | Example files are under FarhanWazir/GoogleMaps/Example: 74 | 75 | Controller Example; reference code for display method 76 | ```php 77 | /******** Custom Map Controls ********/ 78 | 79 | $leftTopControls = ['document.getElementById("leftTopControl")']; // values must be html or javascript element 80 | $this->gmap->injectControlsInLeftTop = $leftTopControls; // inject into map 81 | $leftCenterControls = ['document.getElementById("leftCenterControl")']; 82 | $this->gmap->injectControlsInLeftCenter = $leftCenterControls; 83 | $leftBottomControls = ['document.getElementById("leftBottomControl")']; 84 | $this->gmap->injectControlsInLeftBottom = $leftBottomControls; 85 | 86 | $bottomLeftControls = ['document.getElementById("bottomLeftControl")']; 87 | $this->gmap->injectControlsInBottomLeft = $bottomLeftControls; 88 | $bottomCenterControls = ['document.getElementById("bottomCenterControl")']; 89 | $this->gmap->injectControlsInBottomCenter = $bottomCenterControls; 90 | $bottomRightControls = ['document.getElementById("bottomRightControl")']; 91 | $this->gmap->injectControlsInBottomRight = $bottomRightControls; 92 | 93 | $rightTopControls = ['document.getElementById("rightTopControl")']; 94 | $this->gmap->injectControlsInRightTop = $rightTopControls; 95 | $rightCenterControls = ['document.getElementById("rightCenterControl")']; 96 | $this->gmap->injectControlsInRightCenter = $rightCenterControls; 97 | $rightBottomControls = ['document.getElementById("rightBottomControl")']; 98 | $this->gmap->injectControlsInRightBottom = $rightBottomControls; 99 | 100 | $topLeftControls = ['document.getElementById("topLeftControl")']; 101 | $this->gmap->injectControlsInTopLeft = $topLeftControls; 102 | $topCenterControls = ['document.getElementById("topCenterControl")']; 103 | $this->gmap->injectControlsInTopCenter = $topCenterControls; 104 | $topRightControls = ['document.getElementById("topRightControl")']; 105 | $this->gmap->injectControlsInTopRight = $topRightControls; 106 | 107 | /******** End Controls ********/ 108 | 109 | $config = array(); 110 | $config['map_height'] = "100%"; 111 | $config['center'] = 'Clifton, Karachi'; 112 | 113 | $this->gmap->initialize($config); // Initialize Map with custom configuration 114 | 115 | /*********** Marker Setup ***********/ 116 | $marker = array(); 117 | $marker['draggable'] = true; 118 | //Marker event dragend 119 | $marker['ondragend'] = ' 120 | iw_'. $this->gmap->map_name .'.close(); 121 | reverseGeocode(event.latLng, function(status, result, mark){ 122 | if(status == 200){ 123 | iw_'. $this->gmap->map_name .'.setContent(result); 124 | iw_'. $this->gmap->map_name .'.open('. $this->gmap->map_name .', mark); 125 | } 126 | }, this); 127 | '; 128 | $this->gmap->add_marker($marker); 129 | /*********** End Marker Setup ***********/ 130 | 131 | $map = $this->gmap->create_map(); // This object will render javascript files and map view; you can call JS by $map['js'] and map view by $map['html'] 132 | 133 | return view('map', ['map' => $map]); 134 | ``` 135 | 136 | Route Example 137 | ```php 138 | Route::get('/map', 'MapController@index'); 139 | 140 | Route::get('/', function(){ 141 | $config = array(); 142 | $config['center'] = 'New York, USA'; 143 | GMaps::initialize($config); 144 | $map = GMaps::create_map(); 145 | 146 | echo $map['js']; 147 | echo $map['html']; 148 | }); 149 | ``` 150 | 151 | View Example 152 | ```html 153 | 154 |
155 | {!! $map['js'] !!} 156 | 157 | 158 |