Response
Response
Methods
ok
public ok(): OKfile
Creates and returns a new File instance.
public file(string $file, ?Manager $manager): FileParameters
| Parameter | Type | Description |
|---|---|---|
$file | string | the file to be handled, either as a File object or a file path string |
$manager | Manager | optional manager instance to associate with the file |
html
Generates an HTML response with the given content and HTTP status code.
public html(string $content, int $status = 200): HTMLParameters
| Parameter | Type | Description |
|---|---|---|
$content | string | the HTML content to be returned in the response |
$status | int | the HTTP status code for the response (default is 200) |
image
Creates and returns a new Image instance.
public image(string $filename, int $quality = 8, ?Manager $manager): ImageParameters
| Parameter | Type | Description |
|---|---|---|
$filename | string | the path to the image file |
$quality | int | the quality setting for the image (default is 8) |
$manager | Manager | optional image manager instance |
json
Returns a JSON response with the given data and HTTP status code.
public json(\stdClass $data, int $status = 200): JSONParameters
| Parameter | Type | Description |
|---|---|---|
$data | \stdClass | the data to be encoded as JSON in the response |
$status | int | the HTTP status code for the response (default is 200) |
Creates and returns a new PDF response.
public PDF(string $file, bool $downloadable = true): PDFParameters
| Parameter | Type | Description |
|---|---|---|
$file | string | the path to the PDF file to be served |
$downloadable | bool | Optional. Whether the PDF should be downloaded by the client (default: true). |
text
Creates a new Text response with the given content and HTTP status code.
public text(string $content, int $status = 200): TextParameters
| Parameter | Type | Description |
|---|---|---|
$content | string | the text content to be sent in the response |
$status | int | the HTTP status code for the response (default is 200) |
view
Creates and returns a new View instance with the specified name. public function xml(Element $content, int $status = 200): XML
public view(string $name): View{ return new XML($content, $status); }.
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | the name of the view to instantiate |
xml
Generates an XML response with the given content and HTTP status code.
public xml(Element $content, int $status = 200): XMLParameters
| Parameter | Type | Description |
|---|---|---|
$content | Element | the XML content to include in the response |
$status | int | the HTTP status code for the response (default is 200) |
redirect
Generate a redirect response to redirect the browser.
public redirect(URL $location): RedirectIt's quite common to redirect the user to an alternative URL. This may be to forward the request to another website, forward them to an authentication page or even just remove processed request parameters from the URL to neaten the URL up.
Parameters
| Parameter | Type | Description |
|---|---|---|
$location | URL | The URI you want to redirect to |
shutdown
public shutdown(ControllerResponse $response): voidParameters
| Parameter | Type | Description |
|---|---|---|
$response | ControllerResponse |
Generated by Hazaar API Doc Generator on Sun, 01 Mar 2026 09:22:26 +0000