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

public __wakeup()
inherited from Exception

Documentation missing

public final getMessage()
inherited from Exception

Documentation missing

public final getCode()
inherited from Exception

Documentation missing

public final getFile()
inherited from Exception

Documentation missing

public final getLine()
inherited from Exception

Documentation missing

public final getTrace()
inherited from Exception

Documentation missing

public final getPrevious()
inherited from Exception

Documentation missing

public final getTraceAsString()
inherited from Exception

Documentation missing

public __toString()
inherited from Exception

Documentation missing

Source

src/Http/ResponseAlreadySentException.php:24-30