/databox-php

PHP bindings for Databox

Primary LanguagePHPMIT LicenseMIT

Databox bindings for PHP

License Latest Stable Version

The PHP SDK for interacting with the Databox Push API.

Requirements

Autoloading

databox-php uses Composer. The first step to use databox-php is to download composer:

$ curl -s http://getcomposer.org/installer | php

Clone the repo and install dependencies using:

$ git clone https://github.com/databox/databox-php.git && cd databox-php
$ php composer.phar install

Use autoloader from Composer by:

{
    "require": {
        "databox/databox": "@stable"
    }
}

databox-php follows the PSR-4 convention names for its classes, which means you can easily integrate databox-php classes loading in your own autoloader.

Basic example

<?php
require __DIR__ . '/vendor/autoload.php';

use Databox\Client;

$c = new Client('<push_token>');

$ok = $c->push('sales', 203);
if ($ok) {
    echo 'Inserted,...';
}

$c->insertAll([
    ['sales', 203],
    ['sales', 103, '2015-01-01 17:00:00'],
]);

// Or push some attributes
$ok = $c->push('sales', 203, null, [
    'city' => 'Boston'
]);

print_r(
    $c->lastPush(3)
);

// Or push with units
$c->insertAll([
    ['transaction', 12134, null, null, 'USD'],
    ['transaction', 3245, null, null, 'EUR']
]);

Documentation

See the doc directory for more detailed documentation.

License

databox-php is licensed under the MIT License - see the LICENSE file for details.

Contributing

See the contribute guide for more info how to contribute.

Credits & contributors