PHP code example of mabasic / wakatime-php-api

1. Go to this page and download the library: Download mabasic/wakatime-php-api 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/ */

    

mabasic / wakatime-php-api example snippets


composer 



use GuzzleHttp\Client as Guzzle;
use Mabasic\WakaTime\WakaTime;

$wakatime = new WakaTime(new Guzzle, $your_api_key_for_wakatime);

$wakatime->currentUser()

// or

$wakatime->users('username');

$wakatime->summaries($startDate, $endDate, $project = null)

$wakatime->stats($range, $project = null)

$date = '01/22/2016';

$wakatime->heartbeats($date);

$wakatime->getHoursLoggedFor($startDate, $endDate, $project = null)

$startDate = '11/21/2014';
$endDate = '12/21/2014';

$hours = $wakaTime->getHoursLoggedFor($startDate, $endDate);

public function getHoursLoggedForLast($period, $project = null)

$hours = $wakaTime->getHoursLoggedForLast('7 days');

public function getHoursLoggedForToday($project = null)

public function getHoursLoggedForYesterday($project = null)

public function getHoursLoggedForLast7Days($project = null)

public function getHoursLoggedForLast30Days($project = null)

public function getHoursLoggedForThisMonth($project = null)

public function getHoursLoggedForLastMonth($project = null)