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

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

gordalina/mixpanel-bundle
=========================

Symfony bundle for Mixpanel

5.1.0(1y ago)15199.7k↓46.8%14[1 PRs](https://github.com/gordalina/GordalinaMixpanelBundle/pulls)MITPHPPHP ^8.0CI failing

Since Dec 1Pushed 1y ago3 watchersCompare

[ Source](https://github.com/gordalina/GordalinaMixpanelBundle)[ Packagist](https://packagist.org/packages/gordalina/mixpanel-bundle)[ RSS](/packages/gordalina-mixpanel-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (17)Used By (0)

GordalinaMixpanelBundle
=======================

[](#gordalinamixpanelbundle)

[![Build Status](https://github.com/gordalina/GordalinaMixpanelBundle/workflows/ci/badge.svg)](https://github.com/gordalina/GordalinaMixpanelBundle/actions)

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)
    - [Mixpanel Actions](#mixpanel-actions)
    - [Custom Annotations](#custom-annotations)
- [Send an event based on a condition](#send-an-event-based-on-a-condition)
- [MixpanelEvent](#mixpanelevent)
- [Override Props in all Annotations](#override-props-in-all-annotations)
- [Symfony Profiler Integration](#symfony-profiler-integration)
- [Reference Configuration](#reference-configuration)
- [Spec](#spec)
- [License](#license)

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

[](#installation)

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

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

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

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

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

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

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

```
# app/config/config.yml

gordalina_mixpanel:
    projects:
        default:
            token: xxxxxxxxxxxxxxxxxxxx
```

Usage
-----

[](#usage)

This bundle registers a `gordalina_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

```
