Skip to content

PHP server SDK

Install seatlayer/seatlayer-php 0.7.0, inspect an authoritative hold, book with a stable reference, and use the exact PHP resource namespaces.

Updated View as Markdown

Use seatlayer/seatlayer-php from a trusted PHP backend. Version 0.7.0 requires PHP 8.1 or newer with ext-curl, ext-json, and ext-hash, and has no Composer dependencies.

Install and create the client

composer require seatlayer/seatlayer-php:0.7.0
use SeatLayer\SeatLayer;

$seatlayer = new SeatLayer(getenv('SEATLAYER_SECRET_KEY'));
if ($seatlayer->mode !== 'test') {
    throw new RuntimeException('Use a test key while integrating.');
}

Keep SEATLAYER_SECRET_KEY in the server environment. Never expose the client or its sk_… credential to browser or mobile code.

Exact resource surface

The client exposes charts, channels, events, inventory, performanceGroups, sessions, seasons, templates, webhooks, and workspaces.

$seatlayer->performanceGroups contains all 13 released operations: list, create, retrieve, delete, activate, close, retrieveLifecycle, createBuyerAccessSession, listBuyerAccessSessions, revokeBuyerAccessSession, retrieveHold, bookHold, and retrieveBooking.

$seatlayer->seasons contains all 48 frozen 0.7.0 operations. PHP retains the Season prefix, for example createSeason, publishSeasonPlan, bookSeasonHold, commitSeasonRenewalOffer, and exportSeasonSupportSnapshot. The resource covers catalogue, lifecycle, Plans and sales, buyer handoff, holder import, renewals, amendments, reports, recovery, outbox, audit, and support export. Source-only occurrence return/reclaim operations are not part of 0.7.0.

The same 13 Performance Group and 48 Season wire operations are released in all seven official server SDKs; only language naming differs.

The 0.7.0 typed $seatlayer->performanceGroups->create(...) signature covers the default fixed policy but does not expose the newer REST inclusionMode field. Use the REST/raw-request path for flexible_dates; the other typed create fields and all 13 operations remain available.

Inspect and book an Event hold

$eventKey = getenv('SEATLAYER_EVENT_KEY');
$holdId = getenv('SEATLAYER_HOLD_ID');
$bookingRef = getenv('ORDER_ID');

$hold = $seatlayer->inventory->retrieveHold($eventKey, $holdId);
$labels = array_column($hold['items'], 'label');
// Price from $hold['items'] and authorize payment in your commerce system here.
$booking = $seatlayer->inventory->book(
    $eventKey,
    holdId: $holdId,
    labels: $labels,
    bookingRef: $bookingRef,
);

Do not calculate a charge from browser-submitted totals. bookingRef is your commerce system’s immutable join to SeatLayer inventory. If the booking response is lost, call $seatlayer->inventory->retrieveBooking($eventKey, $bookingRef) before deciding whether to repeat the exact same hold, labels, and reference.

Errors, retries, and pagination

Branch on SeatLayer\AuthException, SeatLayer\ConflictException, and SeatLayer\RateLimitException. Use isSoldOut() for the sold-out business outcome and retryAfterSeconds for rate-limit timing.

Reads retry connection failures, 408, 429, and 5xx with exponential backoff and full jitter. These 14 methods also retry with one exact Idempotency-Key: charts->create, charts->copy, templates->instantiateTemplate, events->create, workspaces->create, performanceGroups->create, and seasons->createSeason, updateSeason, deleteSeason, createSeasonPlan, duplicateSeasonToLive, createSeasonHolderImport, createSeasonRenewalOffers, and createSeasonAmendment. Holds, bookings, lifecycle changes, show-once credentials, and raw mutations are single-attempt.

Large lists use a generator:

foreach ($seatlayer->events->listAll() as $event) {
    syncEvent($event);
}

That generator is Event-specific. Performance Group and top-level Season list methods return one cursor page; pass the response’s opaque nextCursor back as cursor until it is absent.

See errors, retries, and idempotency for the shared contract.

Verify and continue

Verify the flow with a test key, a test Event, and a real test hold. Then add webhook verification, choose the correct inventory model, and complete the going-live checklist.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close