class InertiaState implements ReplicableContext

Inertia configuration and request state stored in coroutine Context.

Providers configure one boot baseline outside a coroutine. Each request receives an independent copy so request mutations remain isolated in Swoole's long-running worker model.

Constants

CONTEXT_KEY

The coroutine Context key for this state.

Properties

string $rootView

The root Blade template name.

array<array-key, mixed|ProvidesInertiaProperties> $sharedProps

The shared properties included in every Inertia response.

array<string, array{file: string, line: int}> $shareSources

The source locations of the shared properties, recorded for DevTools. Kept beside the shared properties so props shared during boot carry their sources into each request.

Closure|string|null $version

The asset version resolver or value.

bool|null $encryptHistory

Whether browser history encryption is enabled for this request.

Closure|null $urlResolver

The URL resolver callback for this request.

Closure|null $componentTransformer

The component name transformer callback.

array<string, mixed> $page

The page data for the current request's SSR dispatch.

Response|null $ssrResponse

The cached SSR response for the current page.

bool $ssrDispatched

Whether the SSR gateway has been dispatched for the current page.

Closure|bool|null $ssrDisabled

The condition that determines if SSR is disabled for this request.

array<int, string> $ssrExcludedPaths

The paths excluded from SSR for this request.

Closure|null $ssrRequestConfigurator

The callback that configures the HTTP request sent to the SSR server.

Methods

static InertiaState
current()

Get the current Inertia state.

setPage(array $page)

Set the page data for the current request.

Response|null
dispatchSsr()

Dispatch SSR if it has not already been dispatched for the current page.

replicate()

Copy all current configuration and request state into an independent object.

Details

at line 108
static InertiaState current()

Get the current Inertia state.

Return Value

InertiaState

at line 133
InertiaState setPage(array $page)

Set the page data for the current request.

Parameters

array $page

Return Value

InertiaState

at line 148
Response|null dispatchSsr()

Dispatch SSR if it has not already been dispatched for the current page.

Return Value

Response|null

at line 161
ReplicableContext replicate()

Copy all current configuration and request state into an independent object.

Return Value

ReplicableContext