PHP class to connect with the Toggl API.
This was coded on an early http://morningtrain.dk
It can be installed with composer
composer require morningtrain/toggl-api
It depends on guzzlehttp/guzzle ver.6.
Guzzle can be added with the following composer snippet: (or automatically when installing through composer)
{
"require": {
"guzzlehttp/guzzle": "^6.0"
}
}
For details about the different objects required in the Toggl Api, take a look at their documentation: https://github.com/toggl/toggl_api_docs
$toggl = new MorningTrain\TogglApi\TogglApi('my-api-token');
$toggl->getAvailableEndpoints();
https://github.com/toggl/toggl_api_docs/blob/master/chapters/clients.md
$toggl->createClient($clientObject);
$toggl->updateClient($clientId, $clientObject);
$toggl->deleteClient($clientId);
$toggl->getClients();
$toggl->getClientProjects($clientId);
$toggl->getActiveClientProjects($clientId);
$toggl->getInactiveClientProjects($clientId);
$toggl->getAllClientProjects($clientId);
$toggl->getClientById($clientId);
https://github.com/toggl/toggl_api_docs/blob/master/chapters/project_users.md
$toggl->createProjectUser($projectUserObject);
$toggl->createProjectUsers($projectUserObject);
$toggl->updateProjectUser($projectUserId, $projectUserObject);
$toggl->updateProjectUsers($projectUserIds, $projectUserObject);
$toggl->deleteProjectUser($projectUserId);
$toggl->deleteProjectUsers($projectUserIds);
https://github.com/toggl/toggl_api_docs/blob/master/chapters/projects.md
$toggl->createProject($projectObject);
$toggl->updateProject($projectId, $projectObject);
$toggl->deleteProject($projectId);
$toggl->deleteProjects($projectIds);
$toggl->getProjectUserRelations($projectId);
$toggl->getProjectTasks($projectId);
$toggl->getProject($projectId);
https://github.com/toggl/toggl_api_docs/blob/master/chapters/dashboard.md
$toggl->getDashboardForWorkspace($workspaceId);
https://github.com/toggl/toggl_api_docs/blob/master/chapters/users.md
$related defaults to false. Set it to true, to get related data
$toggl->getMe($related);
$toggl->updateMe($userObject);
$toggl->signup($userObject);
$toggl->resetApiToken();
https://github.com/toggl/toggl_api_docs/blob/master/chapters/workspaces.md
$toggl->getWorkspaces();
$toggl->getWorkspace($workspaceId);
$toggl->updateWorkspace($workspaceId, $workspaceObject);
$toggl->getWorkspaceUsers($workspaceId);
$toggl->getWorkspaceClients($workspaceId);
$toggl->getWorkspaceProjects($workspaceId);
$toggl->getWorkspaceTasks($workspaceId);
$toggl->getWorkspaceTags($workspaceId);
https://github.com/toggl/toggl_api_docs/blob/master/chapters/workspace_users.md
$toggl->inviteUsersToWorkspace($workspaceId, $emails);
$toggl->updateWorkspaceUser($workspaceUserId, $userObject);
$toggl->deleteWorkspaceUser($workspaceUserId);
$toggl->getWorkspaceUserRelations($workspaceId);
https://github.com/toggl/toggl_api_docs/blob/master/chapters/tags.md
$toggl->createTag($tagObject);
$toggl->updateTag($tagId, $tagObject);
$toggl->deleteTag($tagId);
https://github.com/toggl/toggl_api_docs/blob/master/chapters/tags.md
$toggl->getTask($taskId);
$toggl->createTask($taskObject);
$toggl->updateTask($taskId, $taskObject);
$toggl->updateTasks($taskId, $taskObject);
$toggl->deleteTask($taskId);
$toggl->deleteTasks($taskIds);
https://github.com/toggl/toggl_api_docs/blob/master/chapters/time_entries.md
$toggl->createTimeEntry($timeEntryObject);
$toggl->startTimeEntry($timeEntryObject);
$toggl->stopTimeEntry($timeEntryIds);
$toggl->getTimeEntry($timeEntryIds);
$toggl->getRunningTimeEntry();
$toggl->getTimeEntries();
$toggl->getTimeEntriesInRange($start, $end);
$toggl->updateTagsForTimeEntries($timeEntryIds, $timeEntryObject);
$toggl->updateTimeEntry($timeEntryIds, $timeEntryObject);
$toggl->deleteTimeEntry($timeEntryIds);
https://github.com/toggl/toggl_api_docs/blob/master/reports.md
$toggl = new MorningTrain\TogglApi\TogglReportsApi('my-api-token');
$toggl->getAvailableEndpoints();
$toggl->getProjectReport($query);
$toggl->getSummaryReport($query);
$toggl->getDetailsReport($query);
$toggl->getWeeklyReport($query);