jaam/mixpanel-data-export-api
最新稳定版本:v0.1.3
Composer 安装命令:
composer require jaam/mixpanel-data-export-api
包简介
Wrapper for the Mixpanel Data Export API.
关键字:
README 文档
README
This library wraps the Mixpanel Data Export API for PHP.
To track events and update profiles please see the official Mixpanel PHP Library.
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.
Full documentation of every endpoint, their parameters and responses can be found in the Mixpanel Data Export API documentation.
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.
// 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.
// 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.
// 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' ]);
统计信息
- 总下载量: 48.65k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-12-20