Response
in package
FinalYes
Table of Contents
Constants
- HTTP_BAD_REQUEST = 400
- HTTP_CONFLICT = 409
- HTTP_FORBIDDEN = 403
- HTTP_INTERNAL_SERVER_ERROR = 500
- HTTP_METHOD_NOT_ALLOWED = 405
- HTTP_NOT_FOUND = 404
- HTTP_OK = 200
- HTTP_UNAUTHORIZED = 401
- HTTP_UNPROCESSABLE_ENTITY = 422
Properties
- $headers : ResponseHeaders
- $content : string
- $cookies : array<string|int, mixed>
- $http_code : int
- $send_disabled : bool
- $sent : bool
Methods
- __construct() : mixed
- cookie() : self
- disableSend() : self
- download() : void
- file() : void
- getContent() : string
- getHttpCode() : int
- header() : self
- json() : void
- pdf() : void
- redirect() : self
- send() : void
- setContent() : self
- setHttpCode() : self
- setStatusCode() : self
- view() : void
- withoutCookie() : self
- sanitizeFileName() : string
- sendHeaders() : void
Constants
HTTP_BAD_REQUEST
public
mixed
HTTP_BAD_REQUEST
= 400
HTTP_CONFLICT
public
mixed
HTTP_CONFLICT
= 409
HTTP_FORBIDDEN
public
mixed
HTTP_FORBIDDEN
= 403
HTTP_INTERNAL_SERVER_ERROR
public
mixed
HTTP_INTERNAL_SERVER_ERROR
= 500
HTTP_METHOD_NOT_ALLOWED
public
mixed
HTTP_METHOD_NOT_ALLOWED
= 405
HTTP_NOT_FOUND
public
mixed
HTTP_NOT_FOUND
= 404
HTTP_OK
public
mixed
HTTP_OK
= 200
HTTP_UNAUTHORIZED
public
mixed
HTTP_UNAUTHORIZED
= 401
HTTP_UNPROCESSABLE_ENTITY
public
mixed
HTTP_UNPROCESSABLE_ENTITY
= 422
Properties
$headers
public
ResponseHeaders
$headers
$content
private
string
$content
$cookies
private
array<string|int, mixed>
$cookies
$http_code
private
int
$http_code
$send_disabled
private
bool
$send_disabled
= false
$sent
private
bool
$sent
= false
Methods
__construct()
public
__construct([int $http_code = 200 ]) : mixed
Parameters
- $http_code : int = 200
cookie()
public
cookie(string $name, string|null $value[, int $expire = 0 ][, bool $httpOnly = true ][, bool|null $secure = null ][, string $sameSite = 'Lax' ]) : self
Parameters
- $name : string
- $value : string|null
- $expire : int = 0
- $httpOnly : bool = true
- $secure : bool|null = null
- $sameSite : string = 'Lax'
Return values
selfdisableSend()
public
disableSend([bool $disable = true ]) : self
Parameters
- $disable : bool = true
Return values
selfdownload()
public
download(string $file_path[, string $file_name = '' ]) : void
Parameters
- $file_path : string
- $file_name : string = ''
file()
public
file(string $file_path[, string $file_name = '' ][, string $disposition = 'inline' ]) : void
Parameters
- $file_path : string
- $file_name : string = ''
- $disposition : string = 'inline'
getContent()
public
getContent() : string
Return values
stringgetHttpCode()
public
getHttpCode() : int
Return values
intheader()
public
header(string $name, string $value) : self
Parameters
- $name : string
- $value : string
Return values
selfjson()
public
json(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
pdf()
public
pdf(string $content[, string $file_name = '' ]) : void
Parameters
- $content : string
- $file_name : string = ''
redirect()
public
redirect(string $url[, int $delay = 0 ]) : self
Parameters
- $url : string
- $delay : int = 0
Return values
selfsend()
public
send() : void
setContent()
public
setContent(string $content) : self
Parameters
- $content : string
Return values
selfsetHttpCode()
public
setHttpCode(int $http_code) : self
Parameters
- $http_code : int
Return values
selfsetStatusCode()
public
setStatusCode(int $http_code) : self
replaced by setHttpCode
Parameters
- $http_code : int
Return values
selfview()
public
view(string $view[, array<string|int, mixed> $data = [] ]) : void
Parameters
- $view : string
- $data : array<string|int, mixed> = []
withoutCookie()
public
withoutCookie(string $name) : self
Parameters
- $name : string
Return values
selfsanitizeFileName()
private
sanitizeFileName(string $fileName[, string $prefix = 'file_' ][, string $suffix = '' ]) : string
Parameters
- $fileName : string
- $prefix : string = 'file_'
- $suffix : string = ''
Return values
stringsendHeaders()
private
sendHeaders() : void