How to Integrate Google Map using Gmaps JS?
Today, i am going to show you how to create simple google map in PHP. In this example i use gmaps.js plugin for integrate google map with marker of your location. You can simply generate google map in your any php framework like laravel framework, codeigniter framework, zend framework, cakephp framework etc.
Gmaps.js plugin provide us map events, markers, Geolocation, Geolocation etc. you can use very simply and use your project.
Bellow example you can see i added one marker on my location and also setted title, so you can also see demo and preview after bellow example file.
Preview:
Example:
<!DOCTYPE html>
<html>
<head>
<title>Google map integration in php example</title>
<script src="http://maps.google.com/maps/api/js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gmaps.js/0.4.24/gmaps.js"></script>
<style type="text/css">
#mymap {
border:1px solid red;
width: 800px;
height: 500px;
}
</style>
</head>
<body>
<h1>Google map integration in php example</h1>
<div id="mymap"></div>
<script type="text/javascript">
var mymap = new GMaps({
el: '#mymap',
lat: 21.170240,
lng: 72.831061,
zoom:6
});
mymap.addMarker({
lat: 21.170240,
lng: 72.831061,
title: 'Surat',
click: function(e) {
alert('This is surat, gujarat from India.');
}
});
</script>
</body>
</html>
You can get more information about gmaps.js plugin from here : Gmaps JS.
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- Laravel Google Maps Multiple Markers Example
- Angular Google Maps Marker Click Event Example
- Angular Google Maps Multiple Markers Example
- Angular Google Maps Get Current Location
- React - Rendering an Array of Data with map()
- Google Maps Autocomplete Search Only One Country
- Google Maps API Google Map with Draggable Marker Example
- Google Maps API - Autocomplete Address Search Box with Map Example
- Autocomplete Places Search Box using Google Maps Javascript API
- Laravel Multiple Markers in Google Map using Gmaps.js
- How to Call AngularJS Controller Function in JQuery?
- PHP Crop Image Before Upload using Croppie JS Example
- How to Add Multiple Markers in Google Map using JQuery?
- How to use Google Maps API with JQuery PHP?