Giter Site home page Giter Site logo

toggl-api's Introduction

About

PHP class to connect with the Toggl API.

This was coded on an early http://morningtrain.dk

Installation

It can be installed with composer

composer require morningtrain/toggl-api

Dependencies

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"
    }
}

Changelog

14/06/2021

  • Added methods for some of the undocumented project_group endpoints. This will make it possible to assign, update or remove groups from private projects.

30/06/17

  • Changed function name from getDashboadForWorkspace to getDashboardForWorkspace, if your system is using getDashboadForWorkspace please change it to getDashboardForWorkspace.

Examples

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 API

Initialization

$toggl = new MorningTrain\TogglApi\TogglApi('my-api-token');

Get available endpoints

$toggl->getAvailableEndpoints();

Clients

https://github.com/toggl/toggl_api_docs/blob/master/chapters/clients.md

Creating a client

$toggl->createClient($clientObject);

Updating a client

$toggl->updateClient($clientId, $clientObject);

Deleting a client

$toggl->deleteClient($clientId);

Get all clients

$toggl->getClients();

Get all projects for a client

$toggl->getClientProjects($clientId);

Get all active projects for a client

$toggl->getActiveClientProjects($clientId);

Get all inactive projects for a client

$toggl->getInactiveClientProjects($clientId);

Get both active and inactive projects for a client

$toggl->getAllClientProjects($clientId);

Get client by id

$toggl->getClientById($clientId);

Project users

https://github.com/toggl/toggl_api_docs/blob/master/chapters/project_users.md

Create project user

$toggl->createProjectUser($projectUserObject);

Create project users

$toggl->createProjectUsers($projectUserObject);

Update project user

$toggl->updateProjectUser($projectUserId, $projectUserObject);

Update project users

$toggl->updateProjectUsers($projectUserIds, $projectUserObject);

Create project users

$toggl->deleteProjectUser($projectUserId);

Create project users

$toggl->deleteProjectUsers($projectUserIds);

Projects

https://github.com/toggl/toggl_api_docs/blob/master/chapters/projects.md

Create project

$toggl->createProject($projectObject);

Update project

$toggl->updateProject($projectId, $projectObject);

Delete project

$toggl->deleteProject($projectId);

Delete projects

$toggl->deleteProjects($projectIds);

Get users for project

$toggl->getProjectUserRelations($projectId);

Get project tasks

$toggl->getProjectTasks($projectId);

Get project by ID

$toggl->getProject($projectId);

Dashboard

https://github.com/toggl/toggl_api_docs/blob/master/chapters/dashboard.md

Get dashboard for workspace

$toggl->getDashboardForWorkspace($workspaceId);

Users

https://github.com/toggl/toggl_api_docs/blob/master/chapters/users.md

Get me

$related defaults to false. Set it to true, to get related data

$toggl->getMe($related);

Update me

$toggl->updateMe($userObject);

Sign up

$toggl->signup($userObject);

Reset API Token

$toggl->resetApiToken();

Workspaces

https://github.com/toggl/toggl_api_docs/blob/master/chapters/workspaces.md

Get workspaces

$toggl->getWorkspaces();

Get workspace by ID

$toggl->getWorkspace($workspaceId);

Update workspace

$toggl->updateWorkspace($workspaceId, $workspaceObject);

Get workspace users

$toggl->getWorkspaceUsers($workspaceId);

Get workspace clients

$toggl->getWorkspaceClients($workspaceId);

Get workspace projects

$toggl->getWorkspaceProjects($workspaceId);

Get workspace tasks

$toggl->getWorkspaceTasks($workspaceId);

Get workspace tags

$toggl->getWorkspaceTags($workspaceId);

Workspace users

https://github.com/toggl/toggl_api_docs/blob/master/chapters/workspace_users.md

Invite users to workspace

$toggl->inviteUsersToWorkspace($workspaceId, $emails);

Update workspace user

$toggl->updateWorkspaceUser($workspaceUserId, $userObject);

Delete workspace user

$toggl->deleteWorkspaceUser($workspaceUserId);

Get workspace users for workspace

$toggl->getWorkspaceUserRelations($workspaceId);

Tags

https://github.com/toggl/toggl_api_docs/blob/master/chapters/tags.md

Create tag

$toggl->createTag($tagObject);

Update tag

$toggl->updateTag($tagId, $tagObject);

Delete tag

$toggl->deleteTag($tagId);

Tasks

https://github.com/toggl/toggl_api_docs/blob/master/chapters/tags.md

Get task

$toggl->getTask($taskId);

Create task

$toggl->createTask($taskObject);

Update task

$toggl->updateTask($taskId, $taskObject);

Update tasks

$toggl->updateTasks($taskId, $taskObject);

Delete task

$toggl->deleteTask($taskId);

Delete tasks

$toggl->deleteTasks($taskIds);

Time entries

https://github.com/toggl/toggl_api_docs/blob/master/chapters/time_entries.md

Create time entry

$toggl->createTimeEntry($timeEntryObject);

Start time entry

$toggl->startTimeEntry($timeEntryObject);

Stop time entry

$toggl->stopTimeEntry($timeEntryIds);

Get time entry

$toggl->getTimeEntry($timeEntryIds);

Get running time entry

$toggl->getRunningTimeEntry();

Get time entries

$toggl->getTimeEntries();

Get time entries in range

$toggl->getTimeEntriesInRange($start, $end);

Update tags for time entries

$toggl->updateTagsForTimeEntries($timeEntryIds, $timeEntryObject);

Update time entry

$toggl->updateTimeEntry($timeEntryIds, $timeEntryObject);

Delete time entry

$toggl->deleteTimeEntry($timeEntryIds);

Reports API

https://github.com/toggl/toggl_api_docs/blob/master/reports.md

Initialization

$toggl = new MorningTrain\TogglApi\TogglReportsApi('my-api-token');

Get available endpoints

$toggl->getAvailableEndpoints();

Methods

Get project report

$toggl->getProjectReport($query);

Get summary report

$toggl->getSummaryReport($query);

Get details report

$toggl->getDetailsReport($query);

Get weekly report

$toggl->getWeeklyReport($query);

toggl-api's People

Contributors

bjarnebonde avatar derhasi avatar rubatharisan avatar charlesfsl avatar arrisar avatar scs-ben avatar mat-gr avatar mohamedboualleg avatar simonjnsson avatar notfloran avatar godbout avatar raitisg avatar karsteel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.