Neuron-PHP

Request
in package

Class Request

Table of Contents

Properties

$_dto  : Dto|null
$_errors  : array<string|int, mixed>
$_headers  : array<string|int, mixed>
$_ipResolver  : DefaultIpResolver
$_name  : string
$_requestMethod  : int
$_routeParameters  : array<string|int, mixed>

Methods

__construct()  : mixed
Request constructor.
cookie()  : mixed
Filtered COOKIE parameter
get()  : mixed
Filtered GET parameter
getClientIp()  : string
getDto()  : Dto|null
Get the DTO instance
getErrors()  : array<string|int, mixed>
getHeaders()  : array<string|int, mixed>
getHttpHeaders()  : array<string|int, mixed>
getJsonPayload()  : array<string|int, mixed>
Returns an array representation of the JSON payload from php://input
getRequestMethod()  : int
Get the type of request. See RequestMethod class for possible values.
getRouteParameter()  : mixed
Get a route parameter by key
getRouteParameters()  : array<string|int, mixed>
Get all route parameters
loadFile()  : void
post()  : mixed
Filtered POST parameter
processPayload()  : void
Process and validate payload data
server()  : mixed
Filtered SERVER parameter
session()  : mixed
Filtered SESSION parameter
setRouteParameters()  : void
Set route parameters
populateDto()  : void
Recursively populate DTO from payload data
resolveDtoPath()  : string
Resolve DTO file path from name Checks: absolute path, relative to current dir, common DTO locations
validateHeaders()  : void
Validate HTTP headers against required headers

Properties

$_errors

private array<string|int, mixed> $_errors = []

$_headers

private array<string|int, mixed> $_headers = []

$_requestMethod

private int $_requestMethod

$_routeParameters

private array<string|int, mixed> $_routeParameters = []

Methods

__construct()

Request constructor.

public __construct() : mixed

Filtered COOKIE parameter

public cookie(string $key[, mixed|null $default = null ]) : mixed
Parameters
$key : string
$default : mixed|null = null

get()

Filtered GET parameter

public get(string $key[, mixed|null $default = null ]) : mixed
Parameters
$key : string
$default : mixed|null = null

getClientIp()

public getClientIp() : string
Return values
string

getDto()

Get the DTO instance

public getDto() : Dto|null
Return values
Dto|null

getErrors()

public getErrors() : array<string|int, mixed>
Return values
array<string|int, mixed>

getHeaders()

public getHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>

getHttpHeaders()

public getHttpHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>

getJsonPayload()

Returns an array representation of the JSON payload from php://input

public getJsonPayload() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRequestMethod()

Get the type of request. See RequestMethod class for possible values.

public getRequestMethod() : int
Return values
int

getRouteParameter()

Get a route parameter by key

public getRouteParameter(string $key) : mixed
Parameters
$key : string

getRouteParameters()

Get all route parameters

public getRouteParameters() : array<string|int, mixed>
Return values
array<string|int, mixed>

loadFile()

public loadFile(string $fileName) : void
Parameters
$fileName : string
Tags
throws
Exception

post()

Filtered POST parameter

public post(string $key[, mixed|null $default = null ]) : mixed
Parameters
$key : string
$default : mixed|null = null

processPayload()

Process and validate payload data

public processPayload(array<string|int, mixed> $payload) : void
Parameters
$payload : array<string|int, mixed>
Tags
throws
Validation

server()

Filtered SERVER parameter

public server(string $key[, mixed|null $default = null ]) : mixed
Parameters
$key : string
$default : mixed|null = null

session()

Filtered SESSION parameter

public session(string $key[, mixed|null $default = null ]) : mixed
Parameters
$key : string
$default : mixed|null = null

setRouteParameters()

Set route parameters

public setRouteParameters(array<string|int, mixed> $routeParameters) : void
Parameters
$routeParameters : array<string|int, mixed>

populateDto()

Recursively populate DTO from payload data

protected populateDto(Dto $dto, array<string|int, mixed> $data) : void
Parameters
$dto : Dto
$data : array<string|int, mixed>

resolveDtoPath()

Resolve DTO file path from name Checks: absolute path, relative to current dir, common DTO locations

protected resolveDtoPath(string $name) : string
Parameters
$name : string
Tags
throws
Exception
Return values
string

validateHeaders()

Validate HTTP headers against required headers

protected validateHeaders() : void

        
On this page

Search results