@@ -16,19 +16,19 @@ If you are using [Laravel](http://laravel.com/) check out [WakaTime Reports and
16
16
17
17
Add to your ` composer.json ` :
18
18
19
- ```
19
+ ``` php
20
20
"mabasic/wakatime-php-api": "~1.0"
21
21
```
22
22
23
- and run ` composer update ` or type this from command line:
23
+ and run ` composer update ` or type this from command line:
24
24
25
- ```
25
+ ``` php
26
26
composer require "mabasic/wakatime-php-api=~1.0"
27
27
```
28
28
29
29
## Usage
30
30
31
- ```
31
+ ``` php
32
32
<?php
33
33
34
34
use GuzzleHttp\Client as Guzzle;
@@ -39,45 +39,53 @@ $wakaTime->setApiKey($your_api_key_for_wakatime);
39
39
```
40
40
41
41
You can get your Api Key from your [ settings page] ( https://wakatime.com/settings ) .
42
-
42
+
43
43
> Be sure to set your Api Key before using any of the methods because you will get an Exception.
44
-
44
+
45
45
## Methods
46
46
47
47
### Official methods
48
48
49
49
#### currentUser
50
50
51
- ```
51
+ ``` php
52
52
$wakatime->currentUser()
53
53
```
54
54
55
55
See: https://wakatime.com/api#users-current for details.
56
56
57
57
#### dailySummary
58
58
59
- ```
59
+ ``` php
60
60
$wakatime->dailySummary($startDate, $endDate, $project = null)
61
61
```
62
62
63
63
See: https://wakatime.com/api#summary-daily for details.
64
64
65
+ #### stats
66
+
67
+ ``` php
68
+ $wakatime->stats($range, $project = null)
69
+ ```
70
+
71
+ See: https://wakatime.com/developers#stats for details.
72
+
65
73
### Additional methods
66
74
67
75
#### getHoursLoggedFor
68
76
69
- ```
77
+ ``` php
70
78
$wakatime->getHoursLoggedFor($startDate, $endDate, $project = null)
71
79
```
72
80
73
- Calculates hours logged for a specific period.
81
+ Calculates hours logged for a specific period.
74
82
_ You can optionally specify a project._
75
83
76
84
> ` $startDate ` must be lower than ` $endDate `
77
85
78
86
** Example:**
79
87
80
- ```
88
+ ``` php
81
89
$startDate = '11/21/2014';
82
90
$endDate = '12/21/2014';
83
91
@@ -86,49 +94,49 @@ $hours = $wakaTime->getHoursLoggedFor($startDate, $endDate);
86
94
87
95
#### getHoursLoggedForLast
88
96
89
- ```
97
+ ``` php
90
98
public function getHoursLoggedForLast($period, $project = null)
91
99
```
92
100
93
- Calculates hours logged in last xy days, months.
101
+ Calculates hours logged in last xy days, months.
94
102
_ You can optionally specify a project._
95
103
96
104
** Example:**
97
105
98
- ```
106
+ ``` php
99
107
$hours = $wakaTime->getHoursLoggedForLast('7 days');
100
108
```
101
109
102
110
#### getHoursLoggedForToday
103
111
104
- ```
112
+ ``` php
105
113
public function getHoursLoggedForToday($project = null)
106
114
```
107
115
108
- Returns hours logged today.
116
+ Returns hours logged today.
109
117
_ You can optionally specify a project._
110
118
111
119
#### getHoursLoggedForYesterday
112
120
113
- ```
121
+ ``` php
114
122
public function getHoursLoggedForYesterday($project = null)
115
123
```
116
124
117
- Returns hours logged yesterday.
125
+ Returns hours logged yesterday.
118
126
_ You can optionally specify a project._
119
127
120
128
#### getHoursLoggedForLast7Days
121
129
122
- ```
130
+ ``` php
123
131
public function getHoursLoggedForLast7Days($project = null)
124
132
```
125
133
126
- Basic users can only see data for maximum 7 days. Become a Premium user to preserve all data history.
134
+ Basic users can only see data for maximum 7 days. Become a Premium user to preserve all data history.
127
135
_ You can still use any method as long as it is under 7 days._
128
136
129
137
#### getHoursLoggedForLast30Days
130
138
131
- ```
139
+ ``` php
132
140
public function getHoursLoggedForLast30Days($project = null)
133
141
```
134
142
@@ -137,7 +145,7 @@ _You can optionally specify a project._
137
145
138
146
#### getHoursLoggedForThisMonth
139
147
140
- ```
148
+ ``` php
141
149
public function getHoursLoggedForThisMonth($project = null)
142
150
```
143
151
@@ -146,7 +154,7 @@ _You can optionally specify a project._
146
154
147
155
#### getHoursLoggedForLastMonth
148
156
149
- ```
157
+ ``` php
150
158
public function getHoursLoggedForLastMonth($project = null)
151
159
```
152
160
@@ -173,4 +181,4 @@ export WAKATIME_API_KEY=xyz
173
181
export WAKATIME_PROJECT=xyz
174
182
```
175
183
176
- _ Of course replace ` xyz ` with correct values._
184
+ _ Of course replace ` xyz ` with correct values._
0 commit comments