PHP code example of celpax / dailypulse

1. Go to this page and download the library: Download celpax/dailypulse 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/ */

    

celpax / dailypulse example snippets




use Celpax\Dailypulse\Client;

DEFINE('ACCESS_KEY_ID','your-access-key-here');
DEFINE('SECRET_ACCESS_KEY','your-secret-access-key-here');

$dailyPulseClient=new Client(ACCESS_KEY_ID,SECRET_ACCESS_KEY);

    $response=$dailyPulseClient->getSites();
    $site_id=$response->json()[0]['id'];

    $response=$dailyPulseClient->getMoodKPI($site_id);
    $green=$response->json()['green'];

    $response=$dailyPulseClient->getGlobalMoodKPI();
    $green=$response->json()['green'];

   $response=$dailyPulseClient->getHistoricalMoodKPI($site_id, $number_of_days);
   $green=$response->json()[0]['green'];

   $response=$dailyPulseClient->getHistoricalGlobalMoodKPI($number_of_days);
   $green=$response->json()[0]['green'];

    $response=$dailyPulseClient->getPulsesPerTypicalDay($site_id);
    $pulses=$response->json()['pulses'];
});

    $response=$dailyPulseClient->getGlobalPulsesPerTypicalDay();
    $pulses=$response->json()['pulses'];
});

    $response=$dailyPulseClient->getHistoricalPulsesPerTypicalDay($site_id, $number_of_days);
    $pulses=$response->json()[0]['pulses'];

    $response=$dailyPulseClient->getHistoricalGlobalPulsesPerTypicalDay($number_of_days);
    $pulses=$response->json()[0]['pulses'];

    $response=$this->dailyPulseClient->echoMsg('hello');
    $this->assertFalse($response->isException());
    $this->assertEquals(200, $response->statusCode());
    $obj=$response->json();
    $this->assertEquals('hello', $obj['msg']);