mini\Http\ResponseAlreadySentException class

Documentation

Exception thrown when a response has already been sent

Used to signal to the dispatcher that a controller has already sent output using classical PHP (echo, header(), etc.) and no PSR-7 response should be emitted.

This is necessary because PSR-15 RequestHandlerInterface::handle() requires a ResponseInterface return value and doesn't allow null.

Example:

// _routes/legacy-endpoint.php
header('Content-Type: text/plain');
echo "Hello World";
// Router detects void/null return and throws ResponseAlreadySentException

Inheritance

Extends: RuntimeException

Implements: Stringable Throwable

Properties (4)

protected mixed $message
protected mixed $code
protected string $file
protected int $line

Methods (10)

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Source

src/Http/ResponseAlreadySentException.php:24-30