ariarijp/phpixela

Pixela API client for PHP

0.2.0 2018-11-18 11:47 UTC

This package is auto-updated.

Last update: 2024-04-19 00:26:08 UTC


README

Pixela API client for PHP.

Installation

$ composer require ariarijp/phpixela dev-master

Usage

<?php

require './vendor/autoload.php';

$token = 'access_token';
$username = 'username';
$graphId = 'graph_id';
$today = date('Ymd');

$client = new \Phpixela\Client($token);
$client->getGraphs($username);

try {
    $client->getPixel($username, $graphId, $today);
} catch (\Exception $e) {
    $client->createPixel($username, $graphId, $today, '0');
}

var_dump($client->getPixel($username, $graphId, $today));

$client->incrementPixel($username, $graphId);
$client->incrementPixel($username, $graphId);
$client->incrementPixel($username, $graphId);

var_dump($client->getPixel($username, $graphId, $today));

$client->decrementPixel($username, $graphId);
$client->decrementPixel($username, $graphId);

var_dump($client->getPixel($username, $graphId, $today));

License

MIT

Author

Takuya Arita