Skip to content

gisforgirard/php-timecamp-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

php-timecamp-api

A Timecamp PHP client. Presents returned data from the Timecamp API as associative arrays.

Installation

$ composer require gisforgirard/php-timecamp-api

Usage

// 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

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.

Client methods

Users

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);

Tasks

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);

TimeEntries

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

$attendance = $timecamp_client->Attendance()->get($array);

AwayTime

$attendance = $timecamp_client->AwayTime()->get($array);

Clients

$clients = $timecamp_client->Clients()->all();

$clients = $timecamp_client->Clients()->update($array);

$clients = $timecamp_client->Clients()->add($array);

Invoices

$invoices = $timecamp_client->Invoices->all();

$invoices = $timecamp_client->Invoices()->update($array);

$invoices = $timecamp_client->Invoices()->add($array);

Timer

$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);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages