# PHP

The PHP SDK (`fivexer/sdk`) is **beta**. It covers the workspace-plane core: tasks, workers, decisions, stats, and webhooks.

## Install

```
bashcomposer 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();
```

## Errors and quotas

```
phpuse 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();
}
```

## Webhooks

```
phpuse Fivexer\SDK\Webhook\Webhook;

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

## Beta status

Skills, workflows, notifications, and the worker-portal plane are not yet implemented. Track progress and vote on priorities at [fivexer/sdks](https://github.com/fivexer/sdks/issues).
