PHP 클래스 Phly\Http\ServerRequest

Extends the Request definition to add methods for accessing incoming data, specifically server parameters, cookies, matched path parameters, query string arguments, body parameters, and upload file information. "Attributes" are discovered via decomposing the request (and usually specifically the URI path), and typically will be injected by the application. Requests are considered immutable; all methods that might change state are implemented such that they retain the internal state of the current message and return a new instance that contains the changed state.
상속: implements Psr\Http\Message\ServerRequestInterface, use trait MessageTrait, use trait RequestTrait
파일 보기 프로젝트 열기: phly/http 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( array $serverParams = [], array $uploadedFiles = [], null | string $uri = null, null | string $method = null, string | resource | Psr\Http\Message\StreamInterface $body = 'php://input', array $headers = [] )
getAttribute ( $attribute, $default = null )
getAttributes ( )
getCookieParams ( )
getMethod ( ) : string Proxy to receive the request method.
getParsedBody ( )
getQueryParams ( )
getServerParams ( )
getUploadedFiles ( )
withAttribute ( $attribute, $value )
withCookieParams ( array $cookies )
withMethod ( string $method ) : self Set the request method.
withParsedBody ( $data )
withQueryParams ( array $query )
withUploadedFiles ( array $uploadedFiles )
withoutAttribute ( $attribute )

비공개 메소드들

메소드 설명
getStream ( string | resource | Psr\Http\Message\StreamInterface $stream ) : void Set the body stream
validateUploadedFiles ( array $uploadedFiles ) Recursively validate the structure in an uploaded files array.

메소드 상세

__construct() 공개 메소드

public __construct ( array $serverParams = [], array $uploadedFiles = [], null | string $uri = null, null | string $method = null, string | resource | Psr\Http\Message\StreamInterface $body = 'php://input', array $headers = [] )
$serverParams array Server parameters, typically from $_SERVER
$uploadedFiles array Upload file information, a tree of UploadedFiles
$uri null | string URI for the request, if any.
$method null | string HTTP method for the request, if any.
$body string | resource | Psr\Http\Message\StreamInterface Message body, if any.
$headers array Headers for the message, if any.

getAttribute() 공개 메소드

public getAttribute ( $attribute, $default = null )

getAttributes() 공개 메소드

public getAttributes ( )

getCookieParams() 공개 메소드

public getCookieParams ( )

getMethod() 공개 메소드

This overrides the parent functionality to ensure the method is never empty; if no method is present, it returns 'GET'.
public getMethod ( ) : string
리턴 string

getParsedBody() 공개 메소드

public getParsedBody ( )

getQueryParams() 공개 메소드

public getQueryParams ( )

getServerParams() 공개 메소드

public getServerParams ( )

getUploadedFiles() 공개 메소드

public getUploadedFiles ( )

withAttribute() 공개 메소드

public withAttribute ( $attribute, $value )

withCookieParams() 공개 메소드

public withCookieParams ( array $cookies )
$cookies array

withMethod() 공개 메소드

Unlike the regular Request implementation, the server-side normalizes the method to uppercase to ensure consistency and make checking the method simpler. This methods returns a new instance.
public withMethod ( string $method ) : self
$method string
리턴 self

withParsedBody() 공개 메소드

public withParsedBody ( $data )

withQueryParams() 공개 메소드

public withQueryParams ( array $query )
$query array

withUploadedFiles() 공개 메소드

public withUploadedFiles ( array $uploadedFiles )
$uploadedFiles array

withoutAttribute() 공개 메소드

public withoutAttribute ( $attribute )