PHPackages                             b2sign/task-engine-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. b2sign/task-engine-sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

b2sign/task-engine-sdk
======================

Task-Engine SDK

0221PHP

Since Mar 31Pushed 1y ago1 watchersCompare

[ Source](https://github.com/hdwong/task-engine-sdk)[ Packagist](https://packagist.org/packages/b2sign/task-engine-sdk)[ RSS](/packages/b2sign-task-engine-sdk/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Task Engine SDK
===============

[](#task-engine-sdk)

The Task Engine SDK is a PHP library that provides a simple interface to interact with the B2Sign Task Engine API. The SDK is designed to make it easy to create, update, and delete tasks, as well as to retrieve task information.

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

[](#installation)

To install the Task Engine SDK, run the following command:

```
composer require b2sign/task-engine-sdk
```

Usage
-----

[](#usage)

To use the Task Engine SDK, you must first create an instance of the `TaskEngine` class. You can then use this instance to interact with the Task Engine API.

```
use B2Sign\TaskEngineSdk\TaskEngine;

$taskEngine = new TaskEngine('api-endpoint', 'your-app-key', 'your-app-secret');
```

### Create a Task

[](#create-a-task)

To create a task, use the `create` method. This method takes an array of task data as its only argument.

```
$task = $taskEngine->setType('type_name')
    ->setCallbackUrl('https://your-callback-url.com')
    ->setPriority('normal')
    ->setUnique([ 'key' => 'value' ])
    ->setKeepAlive(true)
    ->setQueueData([
      'queue1' => [ 1, 2, 3 ],
      'queue2' => [ 'a', 'b', 'c' ],
    ])
    ->setData([
      'foo' => 'bar',
    ])
    ->setTask('task-id')  // Optional for creating keep-alive tasks
    ->create();
```

#### Reference

[](#reference)

- `setType(string $type)`: **REQUIRED** The type of the task.
- `setCallbackUrl(string $callbackUrl)`: **REQUIRED** The URL to which the Task Engine will send a POST request when the task is completed.
- `setPriority(string $priority)`: (Optional, default: `normal`) The priority of the task. Possible values are `low`, `normal`, and `high`.
- `setUnique(array $unique | false)`: (Optional, default: `false`) An array of key-value pairs that uniquely identify the task, or `false` if the task is not unique.
- `setKeepAlive(bool $keepAlive)`: (Optional, default: `false`) Whether the task should be kept alive until it is completed.
- `setQueueData(array $queueData)`: (Optional) An array of key-value pairs that will be stored for the task.
- `setData(array $data)`: (Optional) An array of key-value pairs that will be stored for the task.
- `setTask(string $taskId)`: (Optional) The ID of the task to create when creating a keep-alive task. Typically used to update the task queue data.

### Update a Task

[](#update-a-task)

To update a task, use the `update` method. This method takes the task ID as its only argument.

```
$taskId = 'task-id';

$task = $taskEngine->setTask($taskId)
    ->setPriority('high')
    ->update();
```

### Log

[](#log)

To log a message for a task, use the `log` method. This method takes the task ID and the message as its arguments.

```
$taskId = 'task-id';

$task = $taskEngine->setTask($taskId)
    ->log('This is a log message', 'success');
```

#### Reference

[](#reference-1)

- `log(string $message, string $level = null)`
    - `$message`: The log message.
    - `$level`: The log level. Possible values are `success`, `info`, `warning`, and `error`. Default is `info`.

### Complete / Fail a Task

[](#complete--fail-a-task)

To complete or fail a task, use the `complete` or `fail` method. These methods take the task ID as their only argument.

```
$taskId = 'task-id';

$task = $taskEngine->setTask($taskId)
    ->complete('Completed successfully');

$task = $taskEngine->setTask($taskId)
    ->fail('Failed to complete task');
```

### Get a Task

[](#get-a-task)

To get a task, use the `get` method. This method takes the task ID as its only argument.

```
$taskId = 'task-id';

$task = $taskEngine->setTask($taskId)
    ->get();
```

Callback Response
-----------------

[](#callback-response)

When the Task Engine sends a POST request to the callback URL, the response will be a JSON string with a code and message. You can use the `TaskEngine::response` method to create a response object.

```
// Success response
return TaskEngine::response();

// Success response with message
return TaskEngine::response()->withMessage('Task processed successfully');

// Error response with error
return TaskEngine::response()->withError('An error occurred');

// Error response with errors
return TaskEngine::response()->withErrors([
    'Error message 1',
    'Error message 2',
]);
```

License
-------

[](#license)

The Task Engine SDK is open-source software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor1

Top contributor holds 77.8% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/35345557?v=4)[b2sign](/maintainers/b2sign)[@b2sign](https://github.com/b2sign)

---

Top Contributors

[![hdwong](https://avatars.githubusercontent.com/u/5576253?v=4)](https://github.com/hdwong "hdwong (7 commits)")[![nany-source](https://avatars.githubusercontent.com/u/171996035?v=4)](https://github.com/nany-source "nany-source (2 commits)")

### Embed Badge

![Health badge](/badges/b2sign-task-engine-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/b2sign-task-engine-sdk/health.svg)](https://phpackages.com/packages/b2sign-task-engine-sdk)
```

###  Alternatives

[pxlrbt/filament-environment-indicator

Indicator for the current environment inside Filament

1521.2M13](/packages/pxlrbt-filament-environment-indicator)[mastani/laravel-google-static-map

Laravel Google Static Map Generator

481.7M9](/packages/mastani-laravel-google-static-map)[kartik-v/yii2-widget-rangeinput

An enhanced Yii 2 widget encapsulating the HTML 5 range input (sub repo split from yii2-widgets)

214.1M3](/packages/kartik-v-yii2-widget-rangeinput)[contributte/forms-multiplier

Multiplier for nette forms

291.5M5](/packages/contributte-forms-multiplier)[denngarr/seat-srp

A module for SeAT that tracks SRP requests

1226.8k](/packages/denngarr-seat-srp)

PHPackages © 2026

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