xalantis / sdk
Official PHP SDK for the Xalantis API
v0.1.0
2026-04-04 09:54 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- mockery/mockery: ^1.6
- phpunit/phpunit: ^11.0|^12.0
README
Official PHP SDK for the Xalantis API.
Installation
composer require xalantis/sdk
Quick Start
use Xalantis\Xalantis; $client = new Xalantis('sk_live_...');
Tickets
Create a ticket
$response = $client->tickets()->create([ 'subject' => 'Login issue', 'description' => 'Cannot login since the latest update', 'requester_email' => 'user@example.com', 'priority' => 'high', 'category_slug' => 'technical-support', // optional ]); echo $response['data']['uuid']; echo $response['data']['reference'];
List tickets
$response = $client->tickets()->list([ 'status' => 'open', 'priority' => 'high', 'per_page' => 10, 'sort_by' => 'created_at', 'sort_dir' => 'desc', ]); echo $response['meta']['total'] . ' tickets found';
Get a ticket
$response = $client->tickets()->get('ticket-uuid'); $ticket = $response['data'];
Update a ticket
$client->tickets()->update('ticket-uuid', [ 'status' => 'resolved', 'priority' => 'low', ]);
Reply to a ticket
$client->tickets()->reply('ticket-uuid', [ 'content' => 'This has been fixed in v2.1.0', ]); // Internal note (not visible to requester) $client->tickets()->reply('ticket-uuid', [ 'content' => 'Deployed hotfix to production', 'is_internal' => true, ]);
List replies
$response = $client->tickets()->listReplies('ticket-uuid');
Error Handling
use Xalantis\Xalantis; use Xalantis\Exceptions\XalantisException; try { $client->tickets()->create([...]); } catch (XalantisException $e) { echo $e->errorCode; // 'VALIDATION_ERROR' echo $e->getMessage(); // 'Validation failed.' echo $e->status; // 422 print_r($e->details); // ['subject' => ['Required']] // Rate limiting if ($e->status === 429) { sleep($e->retryAfter ?? 60); } }
License
MIT