Examples menu

๐Ÿช„ Multi-step Form

Composition API: client inputs are #[Signal], while the step and validation error are #[Persist] โ€” server-only state that survives between actions and drives the server-side re-render.

#[Persist] step & error โ€” server-controlled state that is never sent to the client and never hydrated from it. Because the class instance lives for the whole connection, the step survives across Next/Back actions.
#[Signal] inputs โ€” name, role, years, editor and the eight stack booleans are two-way bound via data-bind. They are hydrated onto the instance before each action runs.
$ctx->sync() โ€” each action mutates $this->step (a #[Persist] prop the callable view reads live), then calls sync() to re-render the current step. No stale-signal timing issues.
Server-side validation โ€” next() checks $this->name; on failure it sets $this->error and re-renders the same step with the message shown.
Session persistence โ€” saveState() writes the current values to $ctx->setSessionData('wizard', โ€ฆ) on every step. view() resumes from the session on reconnect.
block: 'demo' โ€” only the wizard block re-renders on each step change; the header and anatomy panel stay static in the DOM.
1 Basics 2 Stack 3 Preview

Step 1: The Basics

โšก Signals

step int Persist 1

#[Persist] โ€” server-only current step (1โ€“3). Drives which step UI is rendered.

error string Persist ""

#[Persist] โ€” server-only validation message set by next() on step-1 failure.

name string TAB ""

#[Signal] โ€” developer name, collected in step 1.

role string TAB "Backend Dev"

#[Signal] โ€” selected role from the step-1 dropdown.

years int TAB 3

#[Signal] โ€” years of experience, from the step-1 range slider.

sphp โ€ฆ sother bool TAB false

Eight #[Signal] booleans, one per stack technology, bound to step-2 checkboxes.

editor string TAB "VS Code"

#[Signal] โ€” favourite editor, selected in step 2.

๐ŸŽฏ Actions

next

Validates step 1, increments $this->step, saves to session, then $ctx->sync() renders the next step.

back

Decrements $this->step and re-renders. Signal values from the previous step are preserved.

restart

Resets every signal + #[Persist] prop to defaults, clears the session, and returns to step 1.

๐Ÿ‘ Views

wizard.html.twig

Single template with step-conditional blocks. step/error are passed as plain view data; inputs use auto-injected signals.