PHP code example of ariarijp / phpixela

1. Go to this page and download the library: Download ariarijp/phpixela library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ariarijp / phpixela example snippets




n = '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));