PHPackages                             aliamjid/google-map - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. aliamjid/google-map

ActiveLibrary

aliamjid/google-map
===================

GoogleMaps integration to PHP / Nette framework

1.0.4(6y ago)054MITPHP

Since Jun 23Pushed 6y agoCompare

[ Source](https://github.com/AliAmjid/GoogleMap)[ Packagist](https://packagist.org/packages/aliamjid/google-map)[ RSS](/packages/aliamjid-google-map/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (6)Used By (0)

aliamjid\\google-map
====================

[](#aliamjidgoogle-map)

How to install
--------------

[](#how-to-install)

Add this to composer.json file

```
aliamjid/google-map": "dev-master

```

You also need to add JavaScript file to your website. you will find it in

```
/vendor/aliamjid/google-map/dist/GoogleMapHandler.js

```

How it can look like?
---------------------

[](#how-it-can-look-like)

[![enter image description here](https://camo.githubusercontent.com/b3c812cd64a712ca64606df9d66653e7640788bb3b8bf6125c0d510b224f03ed/68747470733a2f2f692e696d6775722e636f6d2f634f55327655662e6a7067)](https://camo.githubusercontent.com/b3c812cd64a712ca64606df9d66653e7640788bb3b8bf6125c0d510b224f03ed/68747470733a2f2f692e696d6775722e636f6d2f634f55327655662e6a7067)

Example of full nette Component
-------------------------------

[](#example-of-full-nette-component)

```
use aliamjid\GoogleMap\GoogleMap;
use aliamjid\GoogleMap\Objects\Config;
use aliamjid\GoogleMap\Objects\DropMarkerIcon;
use aliamjid\GoogleMap\Objects\Point;
.... use ....
class CustomerMap extends GoogleMap {
  private $idCustomer;
  private $addressMapper;

  public function __construct(
  $name,
 Container $container,
 AddressMapper $addressMapper) {
  $params = $container->getParameters();
  //You need to construct parent with you Google Api Key
  parent::__construct($params['googleApiKey']);
  //Inject your other deps.
  $this->addressMapper = $addressMapper;
 }
  public function defineConfig() {
  //You can also define config of, or can leave it empty
  $config = new Config();
  $config->showFilters = false;
  $this->setConfig($config);
 }
  public function defineFilters() {
  //Here you can define filters
  //1st you need to create aliamjid\GoogleMap\Objects\Group
  $typeFilter = new Group('Address type');
  //Than you can add filter to group
	$typeFilter->addFilter(
	  'type_delivery_filter',
	  'Delivery addresses',
	  'address_type',
	  'delivery'
	);
	//in finel step you need to register Group
	$this->addFilterGroup($typeFilter);
 }
 //In this method you need to define Points
 //This method is called by ajax from javascript, so its async cause of improovement of map performence
  public function definePoints() {
 //Get your data from database
  $defaultAddress = $this->addressMapper->loadOneByCond(array('id_customer' => $this->idCustomer, 'type' => AddressType::DEFAULT_ADDRESS));
  $deliveryAddress = $this->addressMapper->loadOneByCond(array('id_customer' => $this->idCustomer, 'type' => AddressType::DELIVERY_ADDRESS));
  try {

 //we call our custome method
  $this->addPointForAddress($defaultAddress);

  $this->addPointForAddress($deliveryAddress);
 } catch (Exception $e) {
 } }

//We create a custome method for adding address
  private function addPointForAddress(Address $address) {
  //You need to define point
  //Look to aliamjid\objects\Point class for more
  $point = new Point(
  $address->name,
  //Cords, of point
  $address->lat,
  $address->lng,
  //DropMarkericon si clasic Google Map icon, you can define its color, and latter laso

  //Color is in Hex withou # symbol
  //DropMarkerIcon($symbol,$color)
  new DropMarkerIcon(),
  '#',
  $address->street . " " . $address->city . " " . $address->zip,
  'This is' . AddressType::translate($address->type)
 );
 //Now you can data relation to point, for filtering the point
 //1st param os Key thats the "address_type" which we define in filter
 //2nd is Value if key in our case it can be delivery or default

 //Now if the user will turn on "delivery" filter, just point with value of delivery will show up.

  $point->addDataRelation('address_type','delivery');
  //In end you need to register point

  $this->addPoint($point);
 }
  public function setCustomer($idCustomer) {
  $this->idCustomer = $idCustomer;
 }}
```

Now we can create Component in presenter

```
public function createComponentCustomerMap() {
  return $this->customerMap;
}
```

And than you just render it template

```
{control customerMap}
```

And your map is ready.

Description of methods &amp; classes
====================================

[](#description-of-methods--classes)

After you extend you class by **aliamjid\\GoogleMap\\GoogleMap** you need to define 3 compulsory methods

- DefineConfig()
- DefinePoints()
- DefineFilters()

Define config
-------------

[](#define-config)

This method isnt that important you can leave it empty. But its for defining of basic map configuration. You can **set map height,** or you can **hide filters**, if you dont need them.

Example:

```
public function defineConfig() {
  $config = new Config();
  $config->showFilters = false;
  $config->mapHeight = 600;
  //You need to set config
  $this->setConfig($config);
}
```

Define points
-------------

[](#define-points)

This is important one. You are defining points on map here. You need to give an lat &amp; lng to point, give a icon and define description of point

So you start by creating an Point. You will do it like this

```
$point = new vendor/aliamjid/google-
map/src/GoogleMap/Objects/Point(
$name, $lat, $lng, $icon, $nameRedirect = '',$address,$additonalComment = ''
);
```

$lat &amp; $lng are Cords of point

[![enter image description here](https://camo.githubusercontent.com/8caf3c37dc4c7f076a6cee731188d093291db32b6a15a6623862d0130630d077/68747470733a2f2f692e6962622e636f2f54764d4d36384d2f64657363726962652d6d61702e706e67)](https://camo.githubusercontent.com/8caf3c37dc4c7f076a6cee731188d093291db32b6a15a6623862d0130630d077/68747470733a2f2f692e6962622e636f2f54764d4d36384d2f64657363726962652d6d61702e706e67)

**How to set icons color and symbol ?**You can use pre-created class

```
GoogleMap/Objects/DropMarkerIcon

$icon = new DropMarkerIcon($symbol,$color);

```

If you would like to create own icon you can do it like this:

```
class MyCustomeIcon extends aliamjid\GoogleMap\Objects\Icon {

public $src;
public function __construct() {
$this->src = "link/to/icon.png";
}}
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

2516d ago

Major Versions

0.1.0 → 1.0.02019-06-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/cfed0b37dd1b7e15abb66679dec752312a3bcb02985ce9aa9703f2d5e335a13d?d=identicon)[AliAmjid](/maintainers/AliAmjid)

---

Top Contributors

[![AliAmjid](https://avatars.githubusercontent.com/u/32981703?v=4)](https://github.com/AliAmjid "AliAmjid (2 commits)")

---

Tags

nette-image-controlnette-forms-image-extensionphp-jquery-image-resize-library

### Embed Badge

![Health badge](/badges/aliamjid-google-map/health.svg)

```
[![Health](https://phpackages.com/badges/aliamjid-google-map/health.svg)](https://phpackages.com/packages/aliamjid-google-map)
```

###  Alternatives

[nette/nette

👪 Nette Framework - innovative framework for fast and easy development of secured web applications in PHP (metapackage)

1.6k2.8M335](/packages/nette-nette)[ublaboo/datagrid

DataGrid for Nette Framework: filtering, sorting, pagination, tree view, table view, translator, etc

2971.9M23](/packages/ublaboo-datagrid)[nette/code-checker

✅ Nette CodeChecker: A simple tool to check source code against a set of Nette coding standards.

881.7M6](/packages/nette-code-checker)[contributte/forms-bootstrap

Nette extension for Bootstrap forms

211.1M4](/packages/contributte-forms-bootstrap)[tomaj/nette-bootstrap-form

Nette bootstrap form renderer

28440.4k6](/packages/tomaj-nette-bootstrap-form)[contributte/recaptcha

Google reCAPTCHA for Nette - Forms

421.3M4](/packages/contributte-recaptcha)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
