Platform
← Concepts

CONCEPTS FEATURE

Region Contract

A region is a resource with a pipeline, not a partial with lucky context. Each region has its own handler flow, render context and asset collection.

Live demo
Guests see one render. The live every-~2s tick is auth-gated by the framework. Sign in (demo) to watch the server re-render the region live. Sign in (demo) →
server tick #… waiting
--:--:--

Connecting to the server stream…

AsSlotResource Own pipeline and context No hidden partials

Region Contract

Navigation, sidebars, widgets and footers are usually "just includes" — partials handed whatever context happens to be in scope at the call site. That ambient context is a hidden data dependency: it works until someone renders the partial from a page that didn't prepare the right variables, and then it breaks in a way nobody can trace.

Semitexa promotes every region to a first-class slot resource. Declared with #[AsSlotResource], a region has its own resolve pipeline, its own render context, and its own asset collection — rendered through the same Twig as the page, but never depending on the page's ambient variables.

Why a region needs a contract

When regions are real resources, the page composes from independent, inspectable units instead of a web of include-and-pray partials. You can always tell where a region's data comes from and how it refreshes, because it is declared.

It is also the precondition for the next two pillars: only a region with its own pipeline can be deferred (Late HTML) or re-rendered on its own (Live HTML) without dragging the whole page with it. The deferred region in the live demo above is exactly such a resource.

© Linus Torvalds:"Talk is cheap. Show me the code."

a region is a declared slot resourcePresentation boundary
#[AsSlotResource(slot: 'inventory-summary', layout: 'app')]final class InventorySummarySlot{    // Own pipeline, own context — not a partial with lucky variables:    public function resolve(InventorySummaryResource $resource): InventorySummaryResource    {        return $resource->withRows($this->repository->recent());    }}

How it works

A region is declared with #[AsSlotResource]: its own resolve pipeline, its own render context, and its own asset collection, rendered through the same Twig as the page. You can always tell where a region's data comes from and how it refreshes, because it is declared — not improvised from ambient template variables. The deferred region below is exactly such a resource.

Why it matters

When regions are real resources, the page composes from independent, inspectable units instead of a web of include-and-pray partials. It is the precondition for Late HTML and Live HTML: only a region with its own pipeline can be deferred or re-rendered on its own, without dragging the whole page with it.