Skip to content

PHP server SDK

Install seatlayer/seatlayer-php 0.9.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.9.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.9.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, eventSeries, holders, inventory, orders, performanceGroups, sessions, seasons, templates, webhooks, and workspaces. eventSeries, holders (including listCustomers), and orders are new in 0.9.0, and so are the Event sales calls on events: buyer checkout, payment gateway, sales readiness, preflight and transitions, booking fee, and discount codes.

$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 90 Season operations in 0.9.0. 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. 0.9.0 adds performances, Plan edits and package prices, checkout tests, occurrence return and reclaim (returnSeasonOccurrenceInventory, reclaimSeasonOccurrenceInventory), holders, season orders, hosted renewals, bulk jobs, sales and seat reports with CSV exports, and season seats.

Season seats are SDK methods in 0.9.0: setAsideSeasonBlock, retrieveSeasonBlock, and releaseSeasonBlock. Turn them on for a season with 'inventoryMode' => 'block' on createSeason or updateSeason; every Season answer carries inventoryMode (block or per_hold). The set-aside and the release answer 202 with a job; follow it with retrieveSeasonBulkJob. Refusals throw SeatLayer\SeatLayerException or a subclass such as SeatLayer\ConflictException, with the code in errorCode (PHP’s base Exception already owns code). The season seats routes list every refusal.

The same 13 Performance Group and 90 Season wire operations ship in all seven official server SDKs at 0.9.0; only language naming differs.

The 0.9.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);
// An expired, released or booked hold still answers with its status.
if ($hold['status'] !== 'active') {
    throw new RuntimeException('The hold is no longer active');
}
$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 43 methods also retry with one exact Idempotency-Key, generated when you don’t pass one:

  • charts->create, charts->copy, templates->instantiateTemplate, events->create, workspaces->create, and performanceGroups->create;
  • eventSeries->createEventSeries, addEventSeriesDates, and updateEventSeries;
  • holders->updateHolder, createHolderTransfer, createHolderReturn, and createHolderRenewalCheckout;
  • orders->refundEventOrder and cancelEventOrder;
  • 28 on seasons: createSeason, updateSeason, deleteSeason, publishSeason, createSeasonPlan, updateSeasonPlan, deleteSeasonPlan, duplicateSeasonToLive, createSeasonPerformances, attachSeasonPerformances, deleteSeasonPerformance, markSeasonPerformancePast, attachSeasonPlanPerformance, deleteSeasonPlanPerformance, replaceSeasonPackagePrices, createSeasonCheckoutTest, createSeasonHolderImport, createSeasonHolderImportFromSeason, createSeasonRenewalOffers, createSeasonRenewalCheckout, releaseSeasonLapsedOffers, createSeasonAmendment, refundSeasonPerformance, refundSeasonOrder, cancelSeasonOrder, cancelSeasonOrderDate, setAsideSeasonBlock, and releaseSeasonBlock.

Every other mutation is single-attempt: holds, bookings, lifecycle changes other than publishSeason, Event sales settings and discount codes, ticket and renewal emails, occurrence return/reclaim, show-once credentials and renewal links, and raw mutations.

Large lists use a generator:

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

charts->listAll() is the only other generator. Performance Group and top-level Season list methods return one cursor page, and so do the 0.9.0 lists of Season renewal offers, hosted renewals and holders, orders, customers, holder tickets, and event series. Pass the response’s opaque nextCursor back as cursor until it is absent or null.

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