PHP 클래스 Webiny\Component\Http\Request

상속: use trait Webiny\Component\StdLib\SingletonTrait, use trait Webiny\Component\StdLib\StdLibTrait
파일 보기 프로젝트 열기: Webiny/Framework 1 사용 예제들

공개 메소드들

메소드 설명
env ( string $key = null, mixed $value = null ) : mixed Get a value from $_ENV param for the given $key.
files ( string $name, null | integer $arrayOffset = null ) : File Get the File object for the given $name.
getClientIp ( ) : string Get client ip address.
getConnectionPort ( ) : integer Return the connection port number.
getCurrentUrl ( boolean $asUrlObject = false ) : string | UrlObject Get current url with schema, host, port, request uri and query string.
getHostName ( ) : string Returns the host name.
getPayload ( ) : Payload Returns an array object with all post parameters.
getPost ( ) : Post Returns an array object with all POST parameters.
getQuery ( ) : Query Returns an array object with all GET parameters.
getRequestMethod ( ) : string Get request method from HTTP headers
getTrustedHeaders ( ) : array Get a list of trusted headers.
getTrustedProxies ( ) : array Array of IPs from trusted proxies.
header ( string $key = null, mixed $value = null ) : mixed Get a value from HTTP Headers If key doesn't not exist, $value will be returned and assigned under that key.
isDelete ( ) : boolean Checks if current request method is DELETE.
isGet ( ) : boolean Checks if current request method is GET.
isPatch ( ) : boolean Checks if current request method is PATCH.
isPost ( ) : boolean Checks if current request method is POST.
isPut ( ) : boolean Checks if current request method is PUT.
isRequestSecured ( ) : boolean Check if connection is secured.
payload ( string $key = null, mixed $value = null ) : mixed Get a value from request payload param for the given $key.
post ( string $key = null, mixed $value = null ) : mixed Get a value from $_POST param for the given $key.
query ( string $key = null, mixed $value = null ) : mixed Get a value from $_GET param for the given $key.
server ( ) : Server Access to the $_SERVER parameter over a object wrapper.
setCurrentUrl ( string $url ) This method sets the internal value of currentUrl to $url.
setRequestMethod ( string $requestMethod ) Set the request method.

보호된 메소드들

메소드 설명
init ( ) This function prepare the Request and all of its sub-classes.

메소드 상세

env() 공개 메소드

If key doesn't not exist, $value will be returned and assigned under that key.
public env ( string $key = null, mixed $value = null ) : mixed
$key string Key for which you wish to get the value.
$value mixed Default value that will be returned if $key doesn't exist.
리턴 mixed Value of the given $key.

files() 공개 메소드

If you have a multi-dimensional upload field name, than you should pass the optional $arrayOffset param to get the right File object.
public files ( string $name, null | integer $arrayOffset = null ) : File
$name string Name of the upload field.
$arrayOffset null | integer Optional array offset for multi-dimensional upload fields.
리턴 Webiny\Component\Http\Request\Files\File

getClientIp() 공개 메소드

This function check and validates headers from trusted proxies.
public getClientIp ( ) : string
리턴 string Client IP address.

getConnectionPort() 공개 메소드

This function check the forwarded headers from trusted proxies.
public getConnectionPort ( ) : integer
리턴 integer Port number.

getCurrentUrl() 공개 메소드

You can get the result in a form of a string or as a url standard object.
public getCurrentUrl ( boolean $asUrlObject = false ) : string | UrlObject
$asUrlObject boolean In which format you want to get the result, url standard object or a string.
리턴 string | Webiny\Component\StdLib\StdObject\UrlObject\UrlObject Current url.

getHostName() 공개 메소드

This function check the forwarded headers from trusted proxies.
public getHostName ( ) : string
리턴 string Host name

getPayload() 공개 메소드

Returns an array object with all post parameters.
public getPayload ( ) : Payload
리턴 Webiny\Component\Http\Request\Payload

getPost() 공개 메소드

Returns an array object with all POST parameters.
public getPost ( ) : Post
리턴 Webiny\Component\Http\Request\Post

getQuery() 공개 메소드

Returns an array object with all GET parameters.
public getQuery ( ) : Query
리턴 Webiny\Component\Http\Request\Query

getRequestMethod() 공개 메소드

Get request method from HTTP headers
public getRequestMethod ( ) : string
리턴 string

getTrustedHeaders() 공개 메소드

Get a list of trusted headers.
public getTrustedHeaders ( ) : array
리턴 array List of trusted headers.

getTrustedProxies() 공개 메소드

Array of IPs from trusted proxies.
public getTrustedProxies ( ) : array
리턴 array

header() 공개 메소드

Get a value from HTTP Headers If key doesn't not exist, $value will be returned and assigned under that key.
public header ( string $key = null, mixed $value = null ) : mixed
$key string Key for which you wish to get the value.
$value mixed Default value that will be returned if $key doesn't exist.
리턴 mixed Value of the given $key.

init() 보호된 메소드

This class is called automatically by SingletonTrait.
protected init ( )

isDelete() 공개 메소드

Checks if current request method is DELETE.
public isDelete ( ) : boolean
리턴 boolean True if it's DELETE.

isGet() 공개 메소드

Checks if current request method is GET.
public isGet ( ) : boolean
리턴 boolean True if it's GET.

isPatch() 공개 메소드

Checks if current request method is PATCH.
public isPatch ( ) : boolean
리턴 boolean True if it's PATCH.

isPost() 공개 메소드

Checks if current request method is POST.
public isPost ( ) : boolean
리턴 boolean True if it's POST.

isPut() 공개 메소드

Checks if current request method is PUT.
public isPut ( ) : boolean
리턴 boolean True if it's PUT.

isRequestSecured() 공개 메소드

This function check the forwarded headers from trusted proxies.
public isRequestSecured ( ) : boolean
리턴 boolean True if connection is secured (https), otherwise false is returned.

payload() 공개 메소드

If key doesn't not exist, $value will be returned and assigned under that key.
public payload ( string $key = null, mixed $value = null ) : mixed
$key string Key for which you wish to get the value.
$value mixed Default value that will be returned if $key doesn't exist.
리턴 mixed Value of the given $key.

post() 공개 메소드

If key doesn't not exist, $value will be returned and assigned under that key.
public post ( string $key = null, mixed $value = null ) : mixed
$key string Key for which you wish to get the value.
$value mixed Default value that will be returned if $key doesn't exist.
리턴 mixed Value of the given $key.

query() 공개 메소드

If key doesn't not exist, $value will be returned and assigned under that key.
public query ( string $key = null, mixed $value = null ) : mixed
$key string Key for which you wish to get the value.
$value mixed Default value that will be returned if $key doesn't exist.
리턴 mixed Value of the given $key.

server() 공개 메소드

Access to the $_SERVER parameter over a object wrapper.
public server ( ) : Server
리턴 Webiny\Component\Http\Request\Server

setCurrentUrl() 공개 메소드

This method will not actually do a redirect, it is used mostly for mocking the internal value.
public setCurrentUrl ( string $url )
$url string Current url.

setRequestMethod() 공개 메소드

Set the request method.
public setRequestMethod ( string $requestMethod )
$requestMethod string Request method name. Example 'GET', 'POST' ...