2017 © Pedro Peláez
 

library wakatime-php-api

WakaTime API for PHP

image

mabasic/wakatime-php-api

WakaTime API for PHP

  • Saturday, January 21, 2017
  • by mabasic
  • Repository
  • 9 Watchers
  • 42 Stars
  • 1,302 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 17 Forks
  • 0 Open issues
  • 13 Versions
  • 11 % Grown

The README.md

WakaTime PHP API

WakaTime API for PHP, (*1)

Become a Patron, (*2)

Overview

This is a PHP package for WakaTime API. It supports resource endpoints from WakaTime API with additional helper methods for hours logged., (*3)

~~If you are using Laravel check out WakaTime Reports and Laravel~~., (*4)

If you find that some resource endpoints are missing feel free to send me a PR. (Be sure to include tests for your code), (*5)

Installation

Type this from command line:, (*6)

composer require mabasic/wakatime-php-api

Usage

<?php

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

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

You can get your Api Key from your settings page., (*7)

Resource Endpoints

Users

$wakatime->currentUser()

// or

$wakatime->users('username');

See: https://wakatime.com/developers/#users for details., (*8)

Summaries

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

See: https://wakatime.com/developers/#summaries for details., (*9)

Stats

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

See: https://wakatime.com/developers/#stats for details., (*10)

Heartbeats

$date = '01/22/2016';

$wakatime->heartbeats($date);

See: https://wakatime.com/developers#heartbeats for details., (*11)

Helper methods aka Reports aka Shortcuts

getHoursLoggedFor

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

Calculates hours logged for a specific period. You can optionally specify a project., (*12)

$startDate must be lower than $endDate, (*13)

Example:, (*14)

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

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

getHoursLoggedForLast

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

Calculates hours logged in last xy days, months. You can optionally specify a project., (*15)

Example:, (*16)

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

getHoursLoggedForToday

public function getHoursLoggedForToday($project = null)

Returns hours logged today. You can optionally specify a project., (*17)

getHoursLoggedForYesterday

public function getHoursLoggedForYesterday($project = null)

Returns hours logged yesterday. You can optionally specify a project., (*18)

getHoursLoggedForLast7Days

public function getHoursLoggedForLast7Days($project = null)

Basic users can only see data for maximum 7 days. Become a Premium user to preserve all data history. You can still use any method as long as it is under 7 days., (*19)

getHoursLoggedForLast30Days

public function getHoursLoggedForLast30Days($project = null)

Calculates hours logged for last 30 days in history. You can optionally specify a project., (*20)

getHoursLoggedForThisMonth

public function getHoursLoggedForThisMonth($project = null)

Calculates hours logged for this month. You can optionally specify a project., (*21)

getHoursLoggedForLastMonth

public function getHoursLoggedForLastMonth($project = null)

Calculates hours logged for last month. You can optionally specify a project., (*22)


For developers only

Copy .env.example file to .env and set your api key and project name before running tests with:, (*23)

vendor/bin/phpunit

Laravelista Sponsors & Backers

I would like to extend my thanks to the following sponsors & backers for funding my open-source journey. If you are interested in becoming a sponsor or backer, please visit the Laravelista Backers page., (*24)

Contributing

Thank you for considering contributing to WakaTime PHP API! The contribution guide can be found on the Laravelista website., (*25)

Code of Conduct

In order to ensure that the Laravelista community is welcoming to all, please review and abide by the Code of Conduct., (*26)

License

WakaTime PHP API is open-source software licensed under the MIT license., (*27)

The Versions

21/01 2017

dev-master

9999999-dev

WakaTime API for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

api wakatime time tracking

06/08 2016

2.0.2

2.0.2.0

WakaTime API for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

api wakatime time tracking

22/01 2016

2.0.1

2.0.1.0

WakaTime API for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

api wakatime time tracking

22/01 2016

2.0.0

2.0.0.0

WakaTime API for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

api wakatime time tracking

25/11 2015

1.3.0

1.3.0.0

WakaTime API for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

api wakatime time tracking

12/11 2015

1.2.0

1.2.0.0

WakaTime API for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

api wakatime time tracking

15/02 2015

1.1.3

1.1.3.0

WakaTime API for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

api wakatime time tracking

23/12 2014

1.1.2

1.1.2.0

WakaTime API for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

api wakatime time tracking

21/12 2014

1.1.1

1.1.1.0

WakaTime API for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

api wakatime time tracking

21/12 2014

1.1.0

1.1.0.0

WakaTime API for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

api wakatime time tracking

21/12 2014

1.0.2

1.0.2.0

WakaTime API for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

api wakatime time tracking

21/12 2014

1.0.1

1.0.1.0

WakaTime API for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

api wakatime time tracking

21/12 2014

1.0.0

1.0.0.0

WakaTime API for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires