A Timecamp PHP client. Presents returned data from the Timecamp API as associative arrays.
$ composer require gisforgirard/php-timecamp-api
// Require composer autoloader
require "vendor/autoload.php";
$timecamp_client = new Timecamp\Connection('xxxxxxxxxxxxxxxxxxxxxxxx');
$activities = $timecamp_client->ComputerActivities()->getActivity($params);
foreach ($activities as $this_activity) {
$app_id = $this_activity['application_id'];
$window_id = $this_activity['window_title_id'];
echo $app_id." - ".$window_id."\n";
}
Authentication is very simple. You must pass your Timecamp API token when instantiating Timecamp\Connection
. Example:
$timecamp_client = new Timecamp\Connection('xxxxxxxxxxxxxxxxxxxxxxxx');
To get your API token go to your Timecamp Account Settings.
Return all users from account.
Example
$users = $timecamp_client->Users()->all();
foreach ($users as $this_user) {
$all_users[$this_user['user_id']] = $this_user;
}
$users = $all_users;
print_r($users);
these are all functions based exactly on the timecamp api itself, just pass an array of key => var you want to send to the server... anyway there's more specific info in the respective files...
$users = $timecamp_client->Users()->get($array);
$users = $timecamp_client->Users()->post($array);
$users = $timecamp_client->Users()->put($array);
works the same as Tasks (and all the other functions for the most part as well)
$time_entries = $timecamp_client->TimeEntries()->get($array);
$time_entries = $timecamp_client->TimeEntries()->post($array);
$time_entries = $timecamp_client->TimeEntries()->put($array);
$attendance = $timecamp_client->Attendance()->get($array);
$attendance = $timecamp_client->AwayTime()->get($array);
$clients = $timecamp_client->Clients()->all();
$clients = $timecamp_client->Clients()->update($array);
$clients = $timecamp_client->Clients()->add($array);
$invoices = $timecamp_client->Invoices->all();
$invoices = $timecamp_client->Invoices()->update($array);
$invoices = $timecamp_client->Invoices()->add($array);
$timer = $timecamp_client->Timer->all($array);
$timer = $timecamp_client->Timer->status($array);
$timer = $timecamp_client->Timer->stop($array);
ComputerActivities (probably want to look at the individual files or documentation here, things are a bit different)
$activities = $timecamp_client->ComputerActivities()->getActivity('2014-03-07');
$activities = $timecamp_client->ComputerActivities()->getApplication(6319,2132);
$activities = $timecamp_client->ComputerActivities()->getWindowTitle(1,2);
$activities = $timecamp_client->ComputerActivities()->addActivity($array);