Fivexer

PHP

The PHP SDK (fivexer/sdk) requires PHP 8.1+ and covers all three credential planes — workspace, worker, and supervisor.

Install

bash
composer require fivexer/sdk

Quickstart

php
<?php
require 'vendor/autoload.php';

use Fivexer\SDK\Fivexer;
use Fivexer\SDK\Model\CreateTask;
use Fivexer\SDK\Model\UpsertWorker;

$client = new Fivexer('https://api.fivexer.com', 'sk_test_...');
$client->workers()->upsert((new UpsertWorker('agent_1'))->tags(['english', 'billing']));
$task = $client->tasks()->create((new CreateTask(['english', 'billing']))->priority(90));
echo $task->getId() . ' ' . $task->getStatus();

What's covered

The workspace client exposes the full /v1 surface as resource accessors:

tasks(), workers(), skills(), decisions(), workflows(), runs(), learning(), notifications(), teams(), team(), joinLinks(), identities(), history(), breaks(), plus stats(), slaStats(), queueAudit() and portal() directly on the client. A task's sub-resources hang off tasks(): tasks()->context(), tasks()->comments(), tasks()->attachments().

Coverage is enforced, not claimed: ContractParityTest walks contract/operations.yaml and fails the build if the client is missing an operation the contract declares.

Worker portal

php
use Fivexer\SDK\FivexerWorker;
use Fivexer\SDK\Model\WorkerLogin;

$worker = new FivexerWorker('https://api.fivexer.com');
$worker->login(new WorkerLogin('ws_1', 'agent_1', '4821'));
$worker->accept($worker->queue()->getTaskIds()[0]);

Supervisor

php
use Fivexer\SDK\FivexerSupervisor;
use Fivexer\SDK\Model\AcceptSupervisorInvite;

$sv = new FivexerSupervisor('https://api.fivexer.com');
$sv->acceptInvite(new AcceptSupervisorInvite($tokenFromLink));

$board = $sv->overview();
$sv->assign($board->getParked()[0]->getId(), $board->getCrew()[0]->getWorkerId());

Supervisor actions are flat methods here (unpark, setPriority, assign, setAvailability) — only the TypeScript client groups them into namespaces. See the supervisor plane.

Errors and quotas

php
use Fivexer\SDK\Exception\FivexerApiException;

try {
    $client->tasks()->create(new CreateTask(['english']));
} catch (FivexerApiException $e) {
    echo $e->getStatusCode() . ' ' . $e->getCode();
    echo $e->getRetryAfterSeconds();
    echo $e->getQuota()->getTaskRateRemaining();
}

Only the workspace client parses quota headers; the worker and supervisor clients do not.

Webhooks

php
use Fivexer\SDK\Webhook\Webhook;

$event = Webhook::constructEvent($rawBody, $header, 'whsec_...');
echo $event->getEvent();

Pass the raw request body — parsing and re-encoding the JSON changes the bytes the signature was computed over.

Was this page helpful?