How to integrate google map using gmaps.js in php example?

Today now in this post i will show you How to integrate google map using gmaps.js in php example? So here i am going to show you an example of how to create a simple google map in PHP. Now in this example i will be use gmaps.js plugin for integrate the google map with marker of our location. We can simply generate the google map in our any php framework as like laravel framework, codeigniter framework, or zend framework, cakephp framework or any others.

We know Gmaps.js plugin is provide us map events, markers, Geolocation, Geolocation etc. So we can use this very simply and also use our project.

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: 23.8103,
      lng: 90.4125,
      zoom:6
    });
    mymap.addMarker({
      lat: 23.8103,
      lng: 90.4125,
      title: 'Dhaka',
      click: function(e) {
        alert('dhaka Bangladesh');
      }
    });
  </script>
</body>
</html>

Read Also: How to implement infinite ajax scroll pagination in Laravel?

Thanks for read. I hope it help you. For more you can follow us onĀ facebook

close

About Shahriar Sagor

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Shahriar Sagor →