PHPackages                             castrocrea/mixpanel-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. castrocrea/mixpanel-bundle

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

castrocrea/mixpanel-bundle
==========================

Symfony bundle for Mixpanel

3.10.0(4y ago)011MITPHPPHP &gt;=5.2

Since Dec 1Pushed 4y agoCompare

[ Source](https://github.com/castroCrea/GordalinaMixpanelBundle)[ Packagist](https://packagist.org/packages/castrocrea/mixpanel-bundle)[ RSS](/packages/castrocrea-mixpanel-bundle/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (6)Dependencies (7)Versions (17)Used By (0)

CarstrocreaMixpanelBundle
=========================

[](#carstrocreamixpanelbundle)

[![Build Status](https://camo.githubusercontent.com/cb309714b146cc257411fe987509ce51b555a964415b266771fa30c3b3cd4a7b/68747470733a2f2f7472617669732d63692e6f72672f63617374726f637265612f4361727374726f637265614d697870616e656c42756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/castrocrea/CarstrocreaMixpanelBundle)

Integration of the [**Mixpanel**](https://github.com/mixpanel/mixpanel-php) library into Symfony.

- [Installation](#installation)
- [Usage](#usage)
    - [Killer Feature](#killer-feature)
    - [Sending people information to Mixpanel](#sending-people-information-to-mixpanel)
    - [Annotations](#annotations)
    - [Symfony2 Profiler Integration](#symfony2-profiler-integration)
- [Reference Configuration](#reference-configuration)
- [License](#license)

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

[](#installation)

Require [`gordalina/mixpanel-bundle`](https://packagist.org/packages/gordalina/mixpanel-bundle) using composer

```
$ php composer.phar require gordalina/mixpanel-bundle:~3.0
```

Or require [`gordalina/mixpanel-bundle`](https://packagist.org/packages/gordalina/mixpanel-bundle)to your `composer.json` file:

```
{
    "require": {
        "gordalina/mixpanel-bundle": "~3.0"
    }
}
```

Register the bundle in `config/bundles.php`:

```
// config/bundles.php
    return [
        // ...
        Castrocrea\MixpanelBundle\CarstrocreaMixpanelBundle::class => ['all' => true],
    ];
}
```

Enable the bundle's configuration in `app/config/config.yml`:

```
# app/config/config.yml

castrocrea_mixpanel:
    projects:
        default:
            token: xxxxxxxxxxxxxxxxxxxx
```

Usage
-----

[](#usage)

This bundle registers a `castrocrea_mixpanel.default`, `mixpanel.default` and `mixpanel`service which is an instance of `Mixpanel` (from the official library). You'll be able to do whatever you want with it.

**NOTE:** This bundle sends your client's ip address automatically. If you have a reverse proxy in you servers you should set it in your front controller `public/index.php`:

```
// public/index.php
Request::setTrustedProxies(
    // the IP address (or range) of your proxy
    ['192.0.0.1', '10.0.0.0/8'],
    Request::HEADER_X_FORWARDED_ALL
);
```

You can find more documentation on Symfony website: [How to Configure Symfony to Work behind a Load Balancer or a Reverse Proxy](https://symfony.com/doc/current/deployment/proxies.html#solution-settrustedproxies)

### Killer Feature

[](#killer-feature)

Track an event with a single annotation

```
