Overview

Namespaces

  • Docta
    • MercadoLibre
      • Exception
      • OAuth2
        • Client
          • Test
  • GuzzleHttp
    • Cookie
    • Exception
    • Handler
    • Promise
      • Test
      • Tests
    • Psr7
    • Test
      • Handler
    • Tests
      • CookieJar
      • Event
      • Exception
      • Handler
      • Promise
      • Psr7
  • League
    • OAuth2
      • Client
        • Grant
          • Exception
        • Provider
          • Exception
        • Test
          • Grant
          • Provider
            • Exception
            • Fake
          • Token
          • Tool
        • Token
        • Tool
  • None
  • Psr
    • Http
      • Message

Classes

  • AppendStream
  • BufferStream
  • CachingStream
  • DroppingStream
  • FnStream
  • InflateStream
  • LazyOpenStream
  • LimitStream
  • MultipartStream
  • NoSeekStream
  • PumpStream
  • Request
  • Response
  • ServerRequest
  • Stream
  • StreamWrapper
  • UploadedFile
  • Uri
  • UriNormalizer
  • UriResolver

Traits

  • MessageTrait
  • StreamDecoratorTrait

Functions

  • build_query
  • copy_to_stream
  • copy_to_string
  • fread
  • hash
  • mimetype_from_extension
  • mimetype_from_filename
  • modify_request
  • normalize_header
  • parse_header
  • parse_query
  • parse_request
  • parse_response
  • readline
  • rewind_body
  • str
  • stream_for
  • try_fopen
  • uri_for
  • Overview
  • Namespace
  • Class
  • Download

Class ServerRequest

Server-side HTTP request

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.

GuzzleHttp\Psr7\Request implements Psr\Http\Message\RequestInterface uses GuzzleHttp\Psr7\MessageTrait
Extended by GuzzleHttp\Psr7\ServerRequest implements Psr\Http\Message\ServerRequestInterface
Namespace: GuzzleHttp\Psr7
Located at src/ServerRequest.php
Methods summary
public
# __construct( string $method, string|Psr\Http\Message\UriInterface $uri, array $headers = [], string|null|resource|Psr\Http\Message\StreamInterface $body = null, string $version = '1.1', array $serverParams = [] )

Parameters

$method
HTTP method
$uri
URI
$headers
Request headers
$body
Request body
$version
Protocol version
$serverParams
Typically the $_SERVER superglobal

Overrides

GuzzleHttp\Psr7\Request::__construct()
public static array
# normalizeFiles( array $files )

Return an UploadedFile instance array.

Return an UploadedFile instance array.

Parameters

$files
A array which respect $_FILES structure

Returns

array

Throws

InvalidArgumentException
for unrecognized values
public static Psr\Http\Message\ServerRequestInterface
# fromGlobals( )

Return a ServerRequest populated with superglobals: $_GET $_POST $_COOKIE $_FILES $_SERVER

Return a ServerRequest populated with superglobals: $_GET $_POST $_COOKIE $_FILES $_SERVER

Returns

Psr\Http\Message\ServerRequestInterface
public static Psr\Http\Message\UriInterface
# getUriFromGlobals( )

Get a Uri populated with values from $_SERVER.

Get a Uri populated with values from $_SERVER.

Returns

Psr\Http\Message\UriInterface
public array
# getServerParams( )

Retrieve server parameters.

Retrieve server parameters.

Returns

array

Implementation of

Psr\Http\Message\ServerRequestInterface::getServerParams()
public array
# getUploadedFiles( )

Retrieve normalized file upload data.

Retrieve normalized file upload data.

Returns

array

An array tree of UploadedFileInterface instances; an empty array MUST be returned if no data is present.

Implementation of

Psr\Http\Message\ServerRequestInterface::getUploadedFiles()
public static
# withUploadedFiles( array $uploadedFiles )

Create a new instance with the specified uploaded files.

Create a new instance with the specified uploaded files.

Parameters

$uploadedFiles
An array tree of UploadedFileInterface instances.

Returns

static

Throws

InvalidArgumentException
if an invalid structure is provided.

Implementation of

Psr\Http\Message\ServerRequestInterface::withUploadedFiles()
public array
# getCookieParams( )

Retrieve cookies.

Retrieve cookies.

Returns

array

Implementation of

Psr\Http\Message\ServerRequestInterface::getCookieParams()
public static
# withCookieParams( array $cookies )

Return an instance with the specified cookies.

Return an instance with the specified cookies.

Parameters

$cookies
Array of key/value pairs representing cookies.

Returns

static

Implementation of

Psr\Http\Message\ServerRequestInterface::withCookieParams()
public array
# getQueryParams( )

Retrieve query string arguments.

Retrieve query string arguments.

Returns

array

Implementation of

Psr\Http\Message\ServerRequestInterface::getQueryParams()
public static
# withQueryParams( array $query )

Return an instance with the specified query string arguments.

Return an instance with the specified query string arguments.

Parameters

$query

Array of query string arguments, typically from $_GET.

Returns

static

Implementation of

Psr\Http\Message\ServerRequestInterface::withQueryParams()
public null|array|object
# getParsedBody( )

Retrieve any parameters provided in the request body.

Retrieve any parameters provided in the request body.

Returns

null|array|object

The deserialized body parameters, if any. These will typically be an array or object.

Implementation of

Psr\Http\Message\ServerRequestInterface::getParsedBody()
public static
# withParsedBody( null|array|object $data )

Return an instance with the specified body parameters.

Return an instance with the specified body parameters.

Parameters

$data

The deserialized body data. This will typically be in an array or object.

Returns

static

Throws

InvalidArgumentException

if an unsupported argument type is provided.

Implementation of

Psr\Http\Message\ServerRequestInterface::withParsedBody()
public array
# getAttributes( )

Retrieve attributes derived from the request.

Retrieve attributes derived from the request.

Returns

array
Attributes derived from the request.

Implementation of

Psr\Http\Message\ServerRequestInterface::getAttributes()
public mixed
# getAttribute( string $attribute, mixed $default = null )

Retrieve a single derived request attribute.

Retrieve a single derived request attribute.

Parameters

$attribute
$name The attribute name.
$default
Default value to return if the attribute does not exist.

Returns

mixed

Implementation of

Psr\Http\Message\ServerRequestInterface::getAttribute()
public static
# withAttribute( string $attribute, mixed $value )

Return an instance with the specified derived request attribute.

Return an instance with the specified derived request attribute.

Parameters

$attribute
$name The attribute name.
$value
The value of the attribute.

Returns

static

Implementation of

Psr\Http\Message\ServerRequestInterface::withAttribute()
public static
# withoutAttribute( string $attribute )

Return an instance that removes the specified derived request attribute.

Return an instance that removes the specified derived request attribute.

Parameters

$attribute
$name The attribute name.

Returns

static

Implementation of

Psr\Http\Message\ServerRequestInterface::withoutAttribute()
Methods inherited from GuzzleHttp\Psr7\Request
getMethod(), getRequestTarget(), getUri(), withMethod(), withRequestTarget(), withUri()
Methods inherited from Psr\Http\Message\MessageInterface
getBody(), getHeader(), getHeaderLine(), getHeaders(), getProtocolVersion(), hasHeader(), withAddedHeader(), withBody(), withHeader(), withProtocolVersion(), withoutHeader()
Methods used from GuzzleHttp\Psr7\MessageTrait
getBody(), getHeader(), getHeaderLine(), getHeaders(), getProtocolVersion(), hasHeader(), withAddedHeader(), withBody(), withHeader(), withProtocolVersion(), withoutHeader()
MercadoLibre PHP SDK API documentation generated by ApiGen