Examples menu

Live Auction multiplayer

Bid on the item before the clock runs out. A bid in the last 30 seconds sets the clock back to 30. The clock is a server timer, and every bid and tick broadcasts the custom example:auction scope to all viewers.

Server-side countdown: the clock is a $app->setInterval() timer that decrements on the server every second and broadcasts to all viewers. No client-side drift, no JS timers.
Anti-snipe protection: if a bid arrives with fewer than 30 seconds remaining, the clock resets to 30s. Classic auction UX, implemented in four lines of PHP.
A custom scope, example:auction, carries every state change (bids, clock, sold status) to every viewer of the auction at once, whatever tab or session they are on.
SESSION-scoped username persists across page refreshes and new tabs, giving each bidder a consistent identity throughout the auction lifecycle.
Paused when unwatched: the countdown skips its tick while countClients() finds no viewer on any worker, and resumes from where it stopped when someone opens the page.
Full auction lifecycle: active bidding, sold state with winner banner, and a reset action to restart the auction. All state transitions happen in PHP with no client logic.
One worker: this demo keeps the auction in PHP statics, which each worker holds on its own. See What stays per worker before you run it with withWorkerNum().

Ancient Roman Amphora

A remarkably preserved 1st-century terracotta storage jar, excavated near Pompeii. Museum provenance, authenticated.

Estimate: $75 to $200
120s remaining
Current bid $50 No bids yet
$
Bidding as Lynx94

Signals

username string session scope

Bidder identity, auto-assigned on first visit. Persists across tabs and refreshes.

bidInput string tab scope

Draft bid amount. Private to this tab, not broadcast.

Actions

placeBid

Validates bid > current top, updates top bid/bidder, resets clock if anti-snipe triggered, broadcasts to all viewers.

resetAuction

Restarts auction: resets clock, clears bids, sets status back to active. Useful for demo looping.

Views

live_auction.html.twig

Item card, live clock, top bid panel, bid history, and bid form. Full re-render on each broadcast via block: demo.