2017 © Pedro Peláez
 

library mixpanel-data-export-api

Wrapper for the Mixpanel Data Export API.

image

jaam/mixpanel-data-export-api

Wrapper for the Mixpanel Data Export API.

  • Thursday, August 10, 2017
  • by jaam
  • Repository
  • 1 Watchers
  • 2 Stars
  • 9,270 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 14 % Grown

The README.md

Mixpanel Data Export API

This library wraps the Mixpanel Data Export API for PHP., (*1)

To track events and update profiles please see the official Mixpanel PHP Library., (*2)

Installation

composer require jaam/mixpanel-data-export-api

Usage

The Jaam\Mixpanel\DataExportApi class includes two public methods - data and export - one for each of the Data Export APIs., (*3)

Full documentation of every endpoint, their parameters and responses can be found in the Mixpanel Data Export API documentation., (*4)

Setup

<?php

require_once 'vendor/autoload.php';

use Jaam\Mixpanel\DataExportApi;
use Jaam\Mixpanel\DataExportApiException;

$mixpanel = new DataExportApi('YOUR SECRET'); // Secret located in Mixpanel project settings

Data API

See Data Export API documentation for methods, parameters and response examples., (*5)

// Perform setup, as above
try {
    // Retrieve events from `events` endpoint
    $data = $mixpanel->data('events', [
        'event' => ['event_name'], // Array of event names
        'type' => 'unique',
        'unit' => 'day',
        'from_date' => '2016-12-01',
        'to_date' => '2016-12-31'
    ]);

    // $data is an array
} catch ( DataExportApiException $e )
    // Handle exception
}

Export API

See Exporting Raw Data documentation for parameters and response examples., (*6)

// Perform setup, as above
try {
    // Export raw data
    $data = $mixpanel->export([
        'from_date' => '2016-12-01',
        'to_date' => '2016-12-31'
    ]);

    // $data is an array
} catch ( DataExportApiException $e )
    // Handle exception
}

Silex Integration

A small integration with Silex is provided via Jaam\Mixpanel\Integration\Silex\MixpanelDataExportProvider., (*7)

// Bootstrap Silex app

use Jaam\Mixpanel\Integration\Silex\MixpanelDataExportProvider;

$app['mixpanel.api_secret'] = 'YOUR SECRET'; // Secret located in Mixpanel project settings
$app->register(new MixpanelDataExportProvider);

// Use via `mixpanel.api` server later in application
$data = $app['mixpanel.api']->export([
    'from_date' => '2016-12-14',
    'to_date' => '2016-12-18'
]);

The Versions

10/08 2017

dev-master

9999999-dev https://github.com/letsjaam/mixpanel-data-export-api

Wrapper for the Mixpanel Data Export API.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Adam Mustill

mixpanel

10/08 2017

v0.1.2

0.1.2.0 https://github.com/letsjaam/mixpanel-data-export-api

Wrapper for the Mixpanel Data Export API.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Adam Mustill

mixpanel

20/12 2016

v0.1.1

0.1.1.0 https://github.com/letsjaam/mixpanel-data-export-api

Wrapper for the Mixpanel Data Export API.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Adam Mustill

mixpanel

20/12 2016

v0.1.0

0.1.0.0 https://github.com/letsjaam/mixpanel-data-export-api

Wrapper for the Mixpanel Data Export API.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Adam Mustill

mixpanel