PHPackages                             drymek/google-bundle - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. drymek/google-bundle

AbandonedSymfony-bundle[Utility &amp; Helpers](/categories/utility)

drymek/google-bundle
====================

Fork of the GoogleBundle adds support for Javascript maps.

681PHP

Since Jul 24Pushed 13y ago1 watchersCompare

[ Source](https://github.com/drymek/GoogleBundle)[ Packagist](https://packagist.org/packages/drymek/google-bundle)[ RSS](/packages/drymek-google-bundle/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (2)Used By (0)

GoogleBundle
============

[](#googlebundle)

The GoogleBundle adds the ability to add various google-related services to your application. These include Google Analytics, Adwords and Static Maps.

Installation
------------

[](#installation)

### Initialize Submodule

[](#initialize-submodule)

```
git submodule add git@github.com:antimattr/GoogleBundle.git src/AntiMattr/GoogleBundle

```

### Application Kernel

[](#application-kernel)

Add GoogleBundle to the `registerBundles()` method of your application kernel:

```
public function registerBundles()
{
    return array(
        new AntiMattr\GoogleBundle\GoogleBundle(),
    );
}

```

Configuration
-------------

[](#configuration)

### Google Analytics

[](#google-analytics)

#### Application config.yml

[](#application-configyml)

Enable loading of the Google Analytics service by adding the following to the application's `config.yml` file:

```
google:
    analytics:
        trackers:
            default:
                name:      MyJavaScriptCompatibleVariableNameWithNoSpaces
                accountId: UA-xxxx-x
                domain:    .mydomain.com
                trackPageLoadTime: true

```

#### View

[](#view)

Include the Google Analytics Async template in the `head` tag or just before the `` of your layout (The template will lazy load \_gaq).

With twig:

```
{% include "GoogleBundle:Analytics:async.html.twig" %}

```

#### Features

[](#features)

##### Logging a Default Page View

[](#logging-a-default-page-view)

```
Requires no additional code

```

##### Sending a Custom Page View

[](#sending-a-custom-page-view)

```
$this->container()->get('google.analytics')->setCustomPageView('/profile/'.$username);

```

##### Adding to Page View Queue

[](#adding-to-page-view-queue)

Note: Page View Queue is always executed before a Custom Page View

```
$this->container()->get('google.analytics')->enqueuePageView('/my-first-page-view-in-queue');
$this->container()->get('google.analytics')->enqueuePageView('/my-second-page-view-in-queue');

```

##### Ecommerce Tracking

[](#ecommerce-tracking)

```
$transaction = new \AntiMattr\GoogleBundle\Analytics\Transaction();
$transaction->setOrderNumber('xxxx');
$transaction->setAffiliation('Store 777');
$transaction->setTotal(100.00);
$transaction->setTax(10.00);
$transaction->setShipping(5.00);
$transaction->setCity("NYC");
$transaction->setState("NY");
$transaction->setCountry("USA");
$this->get('google.analytics')->setTransaction($transaction);

$item = new \AntiMattr\GoogleBundle\Analytics\Item();
$item->setOrderNumber('xxxx');
$item->setSku('zzzz');
$item->setName('Product X');
$item->setCategory('Category A');
$item->setPrice(50.00);
$item->setQuantity(1);
$this->get('google.analytics')->addItem($item);

$item = new \AntiMattr\GoogleBundle\Analytics\Item();
$item->setOrderNumber('bbbb');
$item->setSku('jjjj');
$item->setName('Product Y');
$item->setCategory('Category B');
$item->setPrice(25.00);
$item->setQuantity(2);
$this->get('google.analytics')->addItem($item);

```

### Google Adwords

[](#google-adwords)

#### Application config.yml

[](#application-configyml-1)

Enable loading of the Google Adwords service by adding the following to the applications's `config.yml` file:

```
google:
    adwords:
        conversions:
            account_create:
                id:    111111
                label: accountCreateLabel
                value: 0
            checkout_thanks:
                id:    222222
                label: checkoutThanksLabel
                value: 0

```

#### Controller

[](#controller)

```
$this->get('google.adwords')->activateConversionByKey('account_create');

```

#### View

[](#view-1)

Include the Google Adwords tracking template like this

```
{% include "GoogleBundle:Adwords:track.html.twig" %}

```

### Google Maps - Static Map

[](#google-maps---static-map)

#### Application config.yml

[](#application-configyml-2)

Enable loading of the Google Maps Static service by adding the following to the applications's `config.yml` file (The static service does NOT require an API Key):

```
google:
    maps: ~

```

#### Controller

[](#controller-1)

```
use AntiMattr\GoogleBundle\Maps\StaticMap;
use AntiMattr\GoogleBundle\Maps\Marker;

...

$map = new StaticMap();
$map->setId("Paul");
$map->setSize("512x512");
$marker = new Marker();
$marker->setLatitude(40.596631);
$marker->setLongitude(-73.972359);
$map->addMarker($marker);
$this->container->get('google.maps')->addMap($map);

```

#### View

[](#view-2)

Include the Google Maps in your template like this:

```
{% if google_maps.hasMaps() %}
	{% for map in google_maps.getMaps() %}
		{% autoescape false %}
			{{ map.render }}
		{% endautoescape %}
	{% endfor %}
{% endif %}

```

### Google Maps - Javascript Map

[](#google-maps---javascript-map)

#### Application config.yml

[](#application-configyml-3)

Enable loading of the Google Maps service by adding the following to the applications's `config.yml` file

```
google:
    maps: ~

```

#### Layout base.html.twig

[](#layout-basehtmltwig)

Add Javascript library:

```
{% javascripts '@GoogleBundle/Resources/public/js/*'
%}

{% endjavascripts %}

```

#### Controller

[](#controller-2)

```
use AntiMattr\GoogleBundle\Maps\Marker;
use AntiMattr\GoogleBundle\MapsManager;

...

$map = $this->get('google.maps')->create(MapsManager::MAP_JAVASCRIPT, 'demo-map');

/**
 * Add marker
 */
$marker = new Marker();
$marker->setLatitude(50.294492);
$marker->setLongitude(18.67138);
$marker->setMeta(array(
    'infowindow' => "Marker 1"
));
$map->addMarker($marker);

// Fit map to markers
$map->setFitToMarkers(true);

$this->get('google.maps')->addMap($map);

```

#### View

[](#view-3)

Include the Google Maps in your template like this:

```
{% if google_maps.hasMaps() %}
    {% for map in google_maps.getMaps() %}
        {% if loop.first %}
            {# Render GoogleMap link only once #}

        {% endif %}

        {% autoescape false %}
            {{ map.render }}
        {% endautoescape %}
    {% endfor %}
{% endif %}

```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/492240?v=4)[Marcin Dryka](/maintainers/drymek)[@drymek](https://github.com/drymek)

---

Top Contributors

[![matthewfitz](https://avatars.githubusercontent.com/u/208401?v=4)](https://github.com/matthewfitz "matthewfitz (52 commits)")[![drymek](https://avatars.githubusercontent.com/u/492240?v=4)](https://github.com/drymek "drymek (13 commits)")[![pulse00](https://avatars.githubusercontent.com/u/185278?v=4)](https://github.com/pulse00 "pulse00 (7 commits)")[![kriswallsmith](https://avatars.githubusercontent.com/u/33886?v=4)](https://github.com/kriswallsmith "kriswallsmith (2 commits)")[![jmikola](https://avatars.githubusercontent.com/u/244663?v=4)](https://github.com/jmikola "jmikola (1 commits)")[![jakzal](https://avatars.githubusercontent.com/u/190447?v=4)](https://github.com/jakzal "jakzal (1 commits)")[![EasierLikeThis](https://avatars.githubusercontent.com/u/599341?v=4)](https://github.com/EasierLikeThis "EasierLikeThis (1 commits)")[![roverwolf](https://avatars.githubusercontent.com/u/210211?v=4)](https://github.com/roverwolf "roverwolf (1 commits)")

### Embed Badge

![Health badge](/badges/drymek-google-bundle/health.svg)

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

###  Alternatives

[joseym/li3_installer

Lithium PHP (li3) 3rd party library installer.

1312.5k2](/packages/joseym-li3-installer)

PHPackages © 2026

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