Skip to content

Internals Response Senders HtmlSender

Stefan Crkvenjakov edited this page Oct 7, 2026 · 1 revision

response\senders\HtmlSender

Framework Internals · Subsystem overview · Developer guide

Source: awt_src/classes/response/senders/HtmlSender.php · Snapshot 8411f4287706.

Response builds status, headers and data/file payloads, chooses a MIME sender, and emits HTTP output. JSON arrays are wrapped in a status/message/data envelope.

HtmlSender

Declaration and architectural role

class HtmlSender extends AbstractSender

Constants, enum cases, traits and properties

No own constants, enum cases, traits or property declarations. Inherited members are documented on the parent reference page.

Method index

Method Signature
supportedMimes public function supportedMimes(): array
send public function send(mixed $payload, int $status, array $headers): void

supportedMimes

Source line 7

public function supportedMimes(): array

Return expressions (including local callbacks): ['text/html', 'application/xhtml+xml'].

Implementation, validation guards and interaction order
public function supportedMimes(): array
    {
        return ['text/html', 'application/xhtml+xml'];
    }

send

Source line 17

public function send(mixed $payload, int $status, array $headers): void

Parameters

Parameter Type, modifiers and default Purpose
$payload mixed $payload Operation input; the exact use, validation and propagation are shown in the implementation trace.
$status int $status Operation input; the exact use, validation and propagation are shown in the implementation trace.
$headers array $headers Operation input; the exact use, validation and propagation are shown in the implementation trace.

$payload may be:

  • string path to an .html file
  • string raw HTML markup (detected by absence of a readable file at that path)

Delegates to emitStatus(), emitContentType(), emitHeaders(), streamFile().

Implementation, validation guards and interaction order
/**
     * $payload may be:
     *  - string path to an .html file
     *  - string raw HTML markup (detected by absence of a readable file at that path)
     */
    public function send(mixed $payload, int $status, array $headers): void
    {
        $this->emitStatus($status);
        $this->emitContentType('text/html; charset=UTF-8');
        $this->emitHeaders($headers);

        if (is_string($payload) && file_exists($payload)) {
            $this->streamFile($payload);
        } else {
            echo (string) $payload;
        }
    }

Related types

Clone this wiki locally