Alpha ZealPHP is early-stage and under active development. APIs may change between minor versions until v1.0. Feedback and bug reports welcome on GitHub.
API Index — Namespaces, Packages, Reports, Indices

Component

Table of Contents

Interfaces

ComponentBinder
Decides which HTML attributes make a component interactive in the browser, and how endpoint side effects (events, redirects, reloads) are signalled.

Classes

Action
Marks a public component method as callable from the browser.
Component
Base class for server-driven components.
ComponentException
A component request the endpoint refuses. The code is the HTTP status: 400 malformed or tampered input, 403 session mismatch or not authorized, 404 unknown component or action, 409 snapshot from another build.
FormBinder
The binder for pages without JavaScript, and the protocol's reference client. Components render as ordinary forms: submitting runs the action and the endpoint answers with a 303 back to the page. Set the component's $tag = 'form' so its controls and action buttons sit inside a form.
HtmxBinder
The first-class binder: makes components interactive with htmx (2.x) attributes on top of the plain-form markup, so pages still work without JS.
Model
Marks a public component property as writable from a form input.
Tester
Drive a reactive component in a unit test, without a server or a browser:
ValidationException
Thrown by {@see Component::validate()} when a field fails its rules. The component endpoint catches it, keeps the errors on the component and re-renders it with status 422.
Validator
Validation for component input. Rules are a |-separated string ('required|email|max:120') or a list mixing rule strings and closures fn(mixed $value, string $field): ?string that return an error message or null.
ZealJsBinder
Components without htmx: a small script (/_zeal/c/zeal.js) that speaks the plain protocol (Zeal-Request: 1, Zeal-Events, Zeal-Redirect, Zeal-Reload, 422 for validation).

Enums

Outcome
How a component request ended, for {@see ComponentBinder::response()}.
On this page