priyolahiri/keenclient-php

A PHP library for reporting events to the Keen IO API

Installs: 2

Dependents: 0

Watchers: 1

Forks: 32

Language: PHP

1.0.0 2013-04-03 10:11 UTC

README

Build Status Still Maintained

This is a library to abstract the Keen IO API addEvent method

Installation

  1. edit composer.json file with following contents:

     "require": {
        "keen-io/keen-io": "dev-master"
     }
  2. install composer via curl -s http://getcomposer.org/installer | php (on windows, download http://getcomposer.org/installer and execute it with PHP)
  3. run php composer.phar install

Use

Configure the service

use KeenIO\Service\KeenIO;

KeenIO::configure($projectId, $apiKey);

Send a new event

KeenIO::addEvent('purchases', array(
    'purchase' => array(
        'item' => 'Golden Elephant'
    ),
));

Create a scoped key

$filter = array(
    'property_name' => 'id', 
    'operator' => 'eq', 
    'property_value' => '123'
);
$filters = array($filter);

$scopedKey = KeenIO::getScopedKey($filters);