← UI Rendering & SSR

UI RENDERING & SSR FEATURE

Components

Open the component class and you can now see both the rendered UI primitive and the backend event contract it is allowed to trigger.

Feature Guide

A quick orientation block that answers the essential questions: what this feature does, how it works, why it matters, and the key concepts behind it.

What this does

Reusable, attribute-registered UI components — discovered automatically from the classmap.

Component Event Bridge

One click, one SSR component contract, one backend event bus.

This button still opens the disclosure layer locally, but it now also dispatches a signed backend event through the generic SSR bridge endpoint.

Local disclosure still works immediately. The component bridge runs in parallel and acknowledges the backend dispatch below.

DemoDisclosureExpanded Declared backend event
click Public trigger contract
/__semitexa_component_event Generic bridge endpoint

Backend acknowledgment

Waiting for the first dispatch…
#[AsComponent] event triggers component_event_attrs() EventDispatcherInterface

Verified against Semitexa Ultimate 2026.09.19.1020

Components

Attribute-registered SSR components with an explicit backend event contract, signed manifest, and one generic dispatch endpoint. Open the component class and you can now see both the rendered UI primitive and the backend event contract it is allowed to trigger.

How it works

Components are discovered at boot from the classmap through #[AsComponent]. A component can declare which backend events it is allowed to trigger. The framework provides one generic dispatch endpoint and a signed manifest so the frontend knows what events are permitted.

When the component renders, component_event_attrs() outputs the data attributes needed for the client runtime to dispatch events through the bridge without custom fetch wiring per component.

Key mechanisms

  • #[AsComponent] — registers the class as a discoverable UI component.
  • event / triggers — declare the backend event contract the component is allowed to trigger.
  • component_event_attrs() — outputs data attributes in Twig for the client dispatch bridge.
  • EventDispatcherInterface — handles incoming component events on the backend.

Why this matters

Components can become interactive without requiring a separate API endpoint per component. The event contract is visible on the component class, the manifest is signed, and one shared bridge handles dispatch. Behavior stays co-located with the component rather than scattered across ad hoc endpoints and frontend fetch calls.

© Jeff Sickel: "Deleted code is debugged code."

Component Class Implementation slice
<?phpdeclare(strict_types=1);namespace App\Application\Component;use Semitexa\Ssr\Attribute\AsComponent;#[AsComponent(    name: 'disclosure-prompt',    template: '@app/components/disclosure-prompt.html.twig',    cacheable: false,)]final class DisclosurePromptComponent{    public function __construct(        public readonly string $label,        public readonly string $target,    ) {}}

Support Semitexa
Built for developers who prefer control over magic. Your support helps keep it fast, open, and evolving.

Donate via PayPal