1. Go to this page and download the library: Download nxi/factro-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nxi / factro-sdk example snippets
use Nxi\Factro\FactroClientFactory;
use Nxi\Factro\FactroOptions;
use Nxi\Factro\Policy\RequestPolicy;
use Nxi\Factro\Resource\Task\Input\NewTask;
use Nxi\Factro\Resource\Task\Input\TaskChanges;
use Nxi\Factro\Resource\Task\TaskState;
use Nxi\Factro\Time\CalendarDate;
$client = FactroClientFactory::create(
token: $token, // raw factro Core API token, sent without "Bearer"
options: new FactroOptions(
policy: RequestPolicy::withoutDeletes(),
logger: $logger,
limiterFactory: $limiterFactory, // optional, default: in-memory sliding window 480/min
),
httpClient: $baseClient, // optional, default: HttpClient::create()
);
$task = $client->tasks()->get('c1c9...');
$open = array_filter($client->tasks()->listByProject($projectId), fn ($t) => $t->taskState->isOpen());
$created = $client->tasks()->create(new NewTask(
title: 'Review offer',
targetParentId: $packageId,
endDate: CalendarDate::fromYmd('2026-09-30'),
));
$client->tasks()->update($created->id, new TaskChanges(description: '<p>Done</p>'));
$client->tasks()->setState($created->id, TaskState::CLOSED);
$client->tasks()->update($taskId, new TaskChanges(clear: ['executorId']));
$users = array_filter($client->users()->list(), fn (User $u) => $u->isActive && !$u->securityGroup->isGuest());
$tags = $client->users()->tagsForMany(array_column($users, 'id'), concurrency: 5); // user id => list<EmployeeTag>
$all = $client->users()->employeeTags(); // GET /users/tags
$entry = $client->tasks()->addChecklistEntry($taskId, new NewChecklistEntry('Call customer'));
$client->tasks()->updateChecklistEntry($taskId, $entry->id, new ChecklistEntryChanges(checked: true));
$tag = $client->tasks()->createTaskTag('urgent');
$client->tasks()->addTag($taskId, $tag->id);
$client->tasks()->moveToPackage($taskId, $packageId); // PUT /tasks/{id}/package
$client->packages()->shiftWithSuccessors($projectId, $packageId, daysDelta: 5);
$rights = $client->projects()->accessRights($projectId);
$rights->grantTeamWrite($teamId);
$reasons = $rights->readRights(); // employee id => list<AccessRightReason>
foreach ($reasons[$employeeId] ?? [] as $r) {
echo $r->reason, ' ', $r->packageId ?? $r->projectId ?? $r->taskId; // e.g. HasDirectPackageTeamWriteRight + packageId, teamId
}
use Nxi\Factro\Testing\Fixtures;
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\HttpClient\Response\JsonMockResponse;
$mock = new MockHttpClient(fn ($method, $url) => JsonMockResponse::fromFile(Fixtures::path('task')), 'https://factro.test/api/core/');
$client = FactroClientFactory::create('test-token', new FactroOptions(baseUrl: 'https://factro.test/api/core', maxRetries: 0), $mock);