ricbra/php-kissmetrics-api

Guzzle based implementation of KISSmetrics REST API

dev-master / 1.0.x-dev 2014-12-24 10:53 UTC

This package is not auto-updated.

Last update: 2024-12-17 04:31:56 UTC


README

Build Status Latest Stable Version Total Downloads License Quality

This library is a PHP 5.4 implementation of the KISSmetrics API

This client is build using Guzzle 4.0.

License

This library is released under the MIT license. See the complete license in the LICENSE file.

Installation

Start by installing composer. Next do:

$ composer require ricbra/php-kissmetrics-api

Requirements

PHP >=5.4.0

Usage

Creating a new instance:

<?php
$client = \KISSmetrics\ClientFactory::factory('your-api-key-here', [
    'defaults' => [
        'headers' => ['User-Agent' => 'your-app-name/1.0.0 +https://yourapp.com']
    ]
]);

Set user properties

<?php

$client->setProperties([
    '_p' => 'Facebook #23',
    '_d' => 1,
    '_t' => 21421421,
    'Property' => 'Value'
]);

Record event

<?php

$client->recordEvent([
    '_p' => 'Facebook #23',
    '_n' => 'Test event',
    '_t' => 12421412,
    '_d' => 1,
    'Property' => 'Value',
]);

Alias user

<?php

$client->recordEvent([
    '_p' => 'Facebook #23',
    '_n' => 'Test event',
    '_t' => 12421412,
    '_d' => 1,
    'Property' => 'Value',
]);