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
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__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 )