Responses

Centum\Http\Response

Response is the base Response class and can be used to display any Response to the user.

Centum\Http\Response(
    string $content,
    Centum\Http\Status $status = Centum\Http\Status::OK,
    Centum\Interfaces\Http\HeadersInterface $headers = null,
    Centum\Interfaces\Http\CookiesInterface $cookies = null
);

Centum\Http\Response implements Centum\Interfaces\Http\ResponseInterface.

Centum\Http\Response\FileResponse

FileResponse prompts a browser to download a file. A custom filename can be set with the $fileName argument.

Centum\Http\Response\FileResponse(
    string $filePath,
    string $fileName
);

Centum\Http\Response\JsonResponse

JsonResponse encodes a variable into a JSON object and pretty prints it.

Centum\Http\Response\JsonResponse(
    mixed $variable
);

Centum\Http\Response\RedirectResponse

RedirectResponse will set the correct headers to tell the HTTP client to redirect to another page. If for some reason, the HTTP client doesn’t obey the redirect, a HTML response is also sent that displays a link to the URL.

Centum\Http\Response\RedirectResponse(
    string $url,
    Centum\Http\Status $status = Centum\Http\Status::FOUND
);

Centum\Http\Response\VariableResponse

VariableResponse can be used in development to display a variable.

Centum\Http\Response\VariableResponse(
    mixed $variable
);