Skip to content

EmptyResponse

github-actions edited this page Mar 29, 2026 · 1 revision

Class EmptyResponse.

Represents an HTTP 204 No Content response.

This class MUST be used when generating responses that intentionally contain no body content, in compliance with RFC 9110. It automatically sets the HTTP status code to 204 (No Content) and applies an optional set of headers.


  • Full name: \FastForward\Http\Message\EmptyResponse
  • Parent class: Response
  • This class is marked as final and can't be subclassed
  • This class is a Final class

Methods

__construct

Constructs a new EmptyResponse instance with optional headers.

public __construct(array $headers = []): mixed

This constructor SHALL initialize the response with HTTP status 204 and no body content. The 'reason' phrase for status 204 is automatically included based on StatusCode enumeration.

Parameters:

Parameter Type Description
$headers array optional headers to include in the response

Clone this wiki locally