PHPackages                             xsolve-pl/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. [API Development](/categories/api)
4. /
5. xsolve-pl/google-bundle

ActiveSymfony-bundle[API Development](/categories/api)

xsolve-pl/google-bundle
=======================

Fork of antimattr/google-bundle and drymek/google-bundle with Javascript Maps added.

03251PHP

Since Jun 11Pushed 13y ago55 watchersCompare

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

READMEChangelogDependenciesVersions (4)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\JavascriptMap;
use AntiMattr\GoogleBundle\Maps\Marker;
use AntiMattr\GoogleBundle\MapsManager;

...

$map = new JavascriptMap();
$map->setId('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

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.2% 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://www.gravatar.com/avatar/09183c33618505e4ae21c86f3d4ffce6eaf2417fc15896c1f8db6b3c62be064f?d=identicon)[mariusz-bak-xsolve-pl](/maintainers/mariusz-bak-xsolve-pl)

---

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)")[![mariusz-bak-xsolve-pl](https://avatars.githubusercontent.com/u/1810317?v=4)](https://github.com/mariusz-bak-xsolve-pl "mariusz-bak-xsolve-pl (8 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)")[![roverwolf](https://avatars.githubusercontent.com/u/210211?v=4)](https://github.com/roverwolf "roverwolf (1 commits)")

### Embed Badge

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

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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