PHPackages                             worksection/worksection-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. worksection/worksection-php-sdk

ActiveLibrary[API Development](/categories/api)

worksection/worksection-php-sdk
===============================

Worksection PHP SDK library to use API

3.3.0(2y ago)03.8k↓100%MITPHPPHP &gt;=7.2

Since Nov 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/worksection/worksection-php-sdk)[ Packagist](https://packagist.org/packages/worksection/worksection-php-sdk)[ RSS](/packages/worksection-worksection-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)DependenciesVersions (14)Used By (0)

Worksection PHP SDK
===================

[](#worksection-php-sdk)

This package provides Worksection PHP SDK. Support admin token auth and OAuth2 Flow.

Installation
------------

[](#installation)

```
composer require worksection/worksection-php-sdk

```

Usage
-----

[](#usage)

To get access to Worksection API you can use admin token API ([how to get token](https://worksection.com/en/faq/api-start.html))

```
use Worksection\SDK\EntityBuilder;
use Worksection\SDK\Exception\SdkException;

$sdk = EntityBuilder::getInstance('https://myaccount.worksection.com/');
$sdk->setAdminToken('0da9fa4321ghm887530cfb8w3m57d3f4');

try {
    $projectsEntity = $sdk->createProjectsEntity(); // Entity for using projects api methods
    $tasksEntity = $sdk->createTasksEntity();       // Entity for using tasks api methods
    $membersEntity = $sdk->createMembersEntity();   // Entity for using members api methods
    $commentsEntity = $sdk->createCommentsEntity()  // Entity for using comments api methods
    $tagsEntity = $sdk->createTagsEntity();         // Entity for using tags api methods
    $costsEntity = $sdk->createCostsEntity();       // Entity for using costs api methods
    $filesEntity = $sdk->createFilesEntity();       // Entity for using files api methods

    // Example of usage (returns data on all projects)
    $result = $projectsEntity->get_projects();

    // Example of usage (creates a project)
    $result = $projectsEntity->post_project('New Test Project', [
        'email_user_from' => 'myemail@gmail.com',
        'email_manager'   => 'myemail@gmail.com',
        'text'            => 'Description of project',
        'datestart'       => '29.12.2023',
        'dateend'         => '29.12.2024'
    ]);

    // Example of usage (closes the specified task (100500 id task in 100 id project)
    $result = $tasksEntity->complete_task(100, 100500);

} catch (SdkException $e) {
    // work with errors
}
```

To get access to Worksection API you can use Oauth2 flow and access token ([how it works](https://worksection.com/en/faq/oauth.html))

```
use Worksection\SDK\EntityBuilder;
use Worksection\SDK\Exception\SdkException;

$sdk = EntityBuilder::getInstance('https://myaccount.worksection.com/');
$sdk->setAccessToken('eyJ0eXAiOiJKV...3v3tKTcdp8zg');

try {
    $projectsEntity = $sdk->createProjectsEntity(); // Entity for using projects api methods
    $tasksEntity = $sdk->createTasksEntity();       // Entity for using tasks api methods
    $membersEntity = $sdk->createMembersEntity();   // Entity for using members api methods
    $commentsEntity = $sdk->createCommentsEntity()  // Entity for using comments api methods
    $tagsEntity = $sdk->createTagsEntity();         // Entity for using tags api methods
    $costsEntity = $sdk->createCostsEntity();       // Entity for using costs api methods
    $filesEntity = $sdk->createFilesEntity();       // Entity for using files api methods

    // Example of usage (returns data on all open and closed account tasks/subtasks)
    $result = $tasksEntity->get_all_tasks();

    // Example of usage (create comments in task)
    $result = $commentsEntity->post_comment(
        'testemail@gmail.com',               // Email user from
        'Text of my comment, hello world!',  // Text of comment
        500,                                 // Project ID
        899                                  // Task ID
    );

} catch (SdkException $e) {
    // work with errors
}
```

To update access token using refresh token you can use method:

```
use Worksection\SDK\EntityBuilder;
use Worksection\SDK\Exception\SdkException;

// Example usage
$tokensData = EntityBuilder::refreshToken(
    '5ba135c31b89r688256h984722891861',                                 // client id
    '71aef25ea193128c9186dd89bf4537f0b0cb2d4f09a2a1b7ed05c98b25fbc1',   // client secret
    'def4720027cbe...89ce27148ad6'                                      // refresh token
);
/**
* Response in tokensData example:
  {
    "token_type": "Bearer",
    "expires_in": 86400,
    "access_token": "eyJ0...cdp7zg",
    "refresh_token": "def50200...8448rd2"
  }
 */
```

Also you can use setAutoRefreshToken method for auto refreshing (only first request, when access token has expired):

```
use Worksection\SDK\EntityBuilder;
use Worksection\SDK\Exception\SdkException;

// Example usage
$sdk = EntityBuilder::getInstance('https://myaccount.worksection.com/');
$sdk->setAccessToken('eyJ0eXAiOiJKV...3v3tKTcdp8zg');

// If access token has expired while the request is being used
// SDK will use the specified refresh token to update access token
// then execute the request and return data with new tokens
$sdk->setAutoRefreshToken(
    '5ba135c31b89r688256h984722891861',                                 // client id
    '71aef25ea193128c9186dd89bf4537f0b0cb2d4f09a2a1b7ed05c98b25fbc1',   // client secret
    'def4720027cbe...89ce27148ad6'                                      // refresh token
);

$projectsEntity = $sdk->createProjectsEntity();
$result = $projectsEntity->get_projects();
/**
* Response example (autorefresh enable):
  {
    "status": "ok",
    "data": [
        {
            "id": "262",
            "name": "",
            "page": "/project/262/",
            "status": "archive",
            "company": "Management",
            "user_from": {
                "id": "111",
                "email": "info1@gmail.com",
                "name": "dev"
            }
        },
        {
            "id": "203",
            "name": "",
            "page": "/project/203/",
            "status": "archive",
            "company": "Design",
            "user_from": {
                "id": "222",
                "email": "info2@gmail.com",
                "name": "Smith John"
            }
        }
     ],
    "access_token": "eyJ0...cdp7zg",
    "refresh_token": "def50200...8448rd2"
  }
 */
```

Available Entities and Methods
------------------------------

[](#available-entities-and-methods)

**[ProjectsEntity](https://github.com/worksection/worksection-php-sdk/blob/develop/src/Entity/ProjectsEntity.php)** - [api docs](https://worksection.com/en/faq/api-projects.html), methods:

```
- get_projects(string $filter = '', string $extra = '')
- close_project(int $projectId)
- post_project(string $title, array $optional = [])
- update_project(int $projectId, array $optional = [])
- get_project_groups()
- add_project_group(string $title)
- get_project(int $projectId, string $extra = '')
- add_project_members(int $projectId, string $members)
- delete_project_members(int $projectId, string $members)
- activate_project(int $projectId)
- get_events(string $period, int $projectId = 0)
```

**[TasksEntity](https://github.com/worksection/worksection-php-sdk/blob/develop/src/Entity/TasksEntity.php)** - [api docs](https://worksection.com/en/faq/api-task.html), methods:

```
- get_all_tasks(string $filter = '', string $extra = '')
- get_task(int $taskId, string $filter = '', string $extra = '')
- get_tasks(int $projectId, string $filter = '', string $extra = '')
- post_task(int $projectId, string $title, array $optional = [])
- complete_task(int $taskId)
- reopen_task(int $taskId)
- update_task(int $taskId, array $optional = [])
- search_tasks(int $projectId, int $taskId = 0, string $emailUserFrom = '', string $emailUserTo = '', string $filter = '', string $status = '')
```

**[MembersEntity](https://github.com/worksection/worksection-php-sdk/blob/develop/src/Entity/MembersEntity.php)** - [api docs](https://worksection.com/en/faq/api-user.html), methods:

```
- me()                          - User method (only for access token)
- get_users()
- get_contacts()
- add_user(string $email, array $optional = [])
- add_contact(string $email, string $name, array $optional = [])
- subscribe(int $taskId, string $emailUser)
- unsubscribe(int $taskId, string $emailUser)
- add_user_group(string $title, int $client = null)
- add_contact_group(string $title)
- get_user_groups()
- get_contact_groups()
```

**[CommentsEntity](https://github.com/worksection/worksection-php-sdk/blob/develop/src/Entity/CommentsEntity.php)** - [api docs](https://worksection.com/en/faq/api-comments.html), methods:

```
- get_comments(int $taskId, string $extra = '')
- post_comment(int $taskId, string $text, array $optional = [])
```

**[TagsEntity](https://github.com/worksection/worksection-php-sdk/blob/develop/src/Entity/TagsEntity.php)** - [api docs](https://worksection.com/en/faq/api-tags.html), methods:

```
- get_task_tag_groups(string $type = '', string $access = '')
- get_project_tag_groups(string $type = '', string $access = '')
- get_task_tags(string $group = '', string $type = '', string $access = '')
- get_project_tags(string $group = '', string $type = '', string $access = '')
- add_task_tag_groups(string $type, string $access, string $title)
- add_project_tag_groups(string $type, string $access, string $title)
- add_task_tags(string $group, string $title)
- update_task_tags(int $taskId, array $optional = [])
- add_project_tags(string $group, string $title)
- update_project_tags(int $projectId, array $optional = [])
```

**[CostsEntity](https://github.com/worksection/worksection-php-sdk/blob/develop/src/Entity/CostsEntity.php)** - [api docs](https://worksection.com/en/faq/api-costs.html), methods:

```
- get_costs(int $projectId = 0, int $taskId = 0, array $optional = [])
- get_costs_total(int $projectId = 0, int $taskId = 0, array $optional = [])
- add_costs(int $taskId, array $optional = [])
- update_costs(int $costsId, array $optional = [])
- delete_costs(int $costsId)
```

**[TimersEntity](https://github.com/worksection/worksection-php-sdk/blob/develop/src/Entity/TimersEntity.php)** - [api docs](https://worksection.com/en/faq/api-costs.html), methods:

```
- get_my_timer()                      - User method (only for access token)
- start_my_timer(int $taskId)         - User method (only for access token)
- stop_my_timer(string $comment = '') - User method (only for access token)
- delete_my_timer()                   - User method (only for access token)
- get_timers()                        - Admin method (only for admin token)
- stop_timer(int $timer)              - Admin method (only for admin token)
```

**[FilesEntity](https://github.com/worksection/worksection-php-sdk/blob/develop/src/Entity/FilesEntity.php)** - [api docs](https://worksection.com/en/faq/api-files.html), methods:

```
- download(int $fileId)
- get_files(int $projectId, int $taskId = 0)
```

**[WebhooksEntity](https://github.com/worksection/worksection-php-sdk/blob/develop/src/Entity/WebhooksEntity.php)** - [api docs](https://worksection.com/en/faq/webhooks.html), methods:

```
- get_webhooks()
- add_webhook(string $url, string $events, string $projectIds = '', string $httpUser = '', string $httpPassword = '')
- delete_webhook(int $webhookId)
```

License
-------

[](#license)

The MIT License (MIT).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

12

Last Release

869d ago

Major Versions

1.4.0 → 2.0.02023-11-22

2.1.0 → 3.0.02023-12-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/0305c909e718f5addcfac4947fa258274c167f4baf16cab960a141a24d95f7f8?d=identicon)[Worksection](/maintainers/Worksection)

---

Top Contributors

[![vadymskk](https://avatars.githubusercontent.com/u/68269374?v=4)](https://github.com/vadymskk "vadymskk (15 commits)")

### Embed Badge

![Health badge](/badges/worksection-worksection-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/worksection-worksection-php-sdk/health.svg)](https://phpackages.com/packages/worksection-worksection-php-sdk)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M474](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M186](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M33](/packages/facebook-php-business-sdk)[microsoft/microsoft-graph

The Microsoft Graph SDK for PHP

65723.5M95](/packages/microsoft-microsoft-graph)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
