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

Demo
in package

Helpers for the /learn demo endpoints — WebSocket fan-out broadcasters, the public-demo rate-limit guard, and the standalone demo-page shell.

Moved verbatim out of route/learn.php so the route file stays function-free and hot-reloadable (a top-level function in a route file fatals "Cannot redeclare" when App::reloadRoutes() re-includes it). Behaviour is unchanged — pure move + rename.

Table of Contents

Methods

demo_rate_check()  : null|array{error: string, limit: int, window: int}
Returns null if the caller is under the limit (proceed). Returns an error payload + sets 429 + Retry-After if rate-limited — caller should return this directly from its route handler.
learn_demo_shell()  : string
learn_ws_broadcast()  : void
ws_counter_demo_broadcast()  : void
ws_session_counter_broadcast()  : void
ws_store_demo_broadcast()  : void

Methods

demo_rate_check()

Returns null if the caller is under the limit (proceed). Returns an error payload + sets 429 + Retry-After if rate-limited — caller should return this directly from its route handler.

public static demo_rate_check() : null|array{error: string, limit: int, window: int}
Return values
null|array{error: string, limit: int, window: int}

learn_demo_shell()

public static learn_demo_shell(string $title, string $body) : string
Parameters
$title : string
$body : string
Return values
string

learn_ws_broadcast()

public static learn_ws_broadcast(int $userId, array<string, mixed> $payload) : void
Parameters
$userId : int
$payload : array<string, mixed>

ws_counter_demo_broadcast()

public static ws_counter_demo_broadcast(int $value) : void
Parameters
$value : int

ws_session_counter_broadcast()

public static ws_session_counter_broadcast(string $sessionId, string $html) : void
Parameters
$sessionId : string
$html : string

ws_store_demo_broadcast()

public static ws_store_demo_broadcast() : void
On this page