aRequest
MMO\core\classes · 1 symbol · generated 30 Sep 2026
aRequest
aRequest.php:19Base implementation of PSR-7's (Server)RequestInterface (Request /
- Namespace
MMO\core\classes- Extends
- aMessage
- Implements
- iRequest, JsonSerializable, Stringable
- See
ShellRequestextend this) -- generic enough to represent an HTTP request or a CLI invocation ("request" in the framework's routing sense, either way). Immutable likeaMessage: everywith*()method returns a clone, leaving the original untouched.
Index
| attributes | ||
| body | ||
| target | ||
| uri | ||
| debugName() | ||
| getAttribute($name, $default) | Retrieve a single derived request attribute. | |
| getAttributes() | Retrieve attributes derived from the request. | |
| getHeader($name) | ||
| getParsedBody() | Retrieve any parameters provided in the request body. | |
| getRequestTarget() | Retrieves the message's request target. | |
| getServerParams() | Retrieve server parameters. | |
| getUri($mutable) | Retrieves the URI instance. | |
| hasHeader($name) | ||
| HeaderName($name) static | The name of the header php's $_SERVER calls $name -- the way a web server hands php a request's headers: HTTP_X_CSRF_TOKEN is X-Csrf-Token, CONTENT_TYPE is Content-Type. | |
| setHeader($name, $value) | ||
| setUri($uri, $preserveHost) | ||
| unsetHeader($name) | ||
| withAttribute($name, $value) | Return an instance with the specified derived request attribute. | |
| withAttributes($attrs) | Return an instance with several derived request attributes set at once (merged via | |
| withoutAttribute($name) | Return an instance that removes the specified derived request attribute. | |
| withParsedBody($data) | Return an instance with the specified body parameters. | |
| withRequestTarget($requestTarget) | Return an instance with the specific request-target. | |
| withUri($uri, $preserveHost) | Returns an instance with the provided URI. | |
| __clone() | ||
| __construct($uri, $headers) | ||
| __toString() |
Properties4
attributes
- Type
- array
body
target
uri
- Type
- Uri
Methods22
debugName()
aRequest.php:40| returns | a short identifier for logs, e.g. '(Request)GET|https://example.com/foo' |
getAttribute($name, $default)
aRequest.php:301Retrieve a single derived request attribute.
| $name | string | The attribute name. |
| $default = null | mixed | Default value to return if the attribute does not exist. |
| returns | mixed |
getAttributes()
aRequest.php:281Retrieve attributes derived from the request.
| returns | array | Attributes derived from the request. |
getHeader($name)
aRequest.php:106- See
tWithHeaders::getHeader, by php's name of the header too (HeaderName)
getParsedBody()
aRequest.php:228Retrieve any parameters provided in the request body.
| returns | ArrayAccess | array | null | The deserialized body parameters, if any. These will typically be an array or object. |
getRequestTarget()
aRequest.php:129Retrieves the message's request target.
| returns | string |
getServerParams()
aRequest.php:374Retrieve server parameters.
| returns | array |
getUri($mutable)
aRequest.php:168Retrieves the URI instance.
| $mutable = false | bool | if true, return a mutable clone of the URI instead of the shared immutable one |
| returns | UriInterface | Returns a UriInterface instance representing the URI of the request. |
hasHeader($name)
aRequest.php:98- See
tWithHeaders::hasHeader, by php's name of the header too (HeaderName)
HeaderName($name)
staticaRequest.php:78The name of the header php's $_SERVER calls $name -- the way a web server hands php a request's headers: HTTP_X_CSRF_TOKEN is X-Csrf-Token, CONTENT_TYPE is Content-Type. Any other name is returned as it is.
setHeader($name, $value)
aRequest.php:86- See
tWithHeaders::setHeader, under the header's own name when $name is php's (HeaderName)
setUri($uri, $preserveHost)
aRequest.php:54unsetHeader($name)
aRequest.php:92- See
tWithHeaders::unsetHeader, by php's name of the header too (HeaderName)
withAttribute($name, $value)
aRequest.php:321Return an instance with the specified derived request attribute.
withAttributes($attrs)
aRequest.php:334Return an instance with several derived request attributes set at once (merged via
- See
merge, so an existing attribute not present in $attrs is kept).
withoutAttribute($name)
aRequest.php:355Return an instance that removes the specified derived request attribute.
| $name | string | The attribute name. |
| returns | self | a clone without $name; or $this unchanged (no clone) if $name was never set to begin with |
withParsedBody($data)
aRequest.php:262Return an instance with the specified body parameters.
| $data | ArrayAccess | array | null | The deserialized body data. This will typically be in an array or object. |
| returns | self | |
| throws | if an unsupported argument type is provided. |
withRequestTarget($requestTarget)
aRequest.php:151Return an instance with the specific request-target.
withUri($uri, $preserveHost)
aRequest.php:204Returns an instance with the provided URI.
| $uri | UriInterface | New request URI to use. |
| $preserveHost = false | Preserve the original state of the Host header. | |
| returns | self |
__clone()
aRequest.php:35__construct($uri, $headers)
aRequest.php:30| $uri | ||
| $headers = [] | array |
__toString()
aRequest.php:45| returns | string | e.g. 'GET|https://example.com/foo' |
Inherited members (51)
| Methods | Declared by | Description | |
|---|---|---|---|
addHeader($name, $value) | aMessage | Append a value to a header, keeping any value(s) already set (as opposed to setHeader, which replaces). | |
AddListener($handler, $order) | aMessage | Register a listener directly (as opposed to ConnectListeners's attribute-based discovery). | |
ConnectListeners($obj) | aMessage | Scan $obj's methods for #[Listen(EventClass::class)] attributes and register each one as a listener on the matching event class. | |
DisconnectListeners($obj) | aMessage | Undo a previous ConnectListeners: removes every listener that connect had registered for $obj on this event class. | |
dispatch() | aMessage | Invoke every GetListeners listener with $this. | |
getBody() | MessageInterface | Gets the body of the message. | |
getCharset() | aMessage | ||
getContentExtension() | aMessage | ||
getContentType($single) | aMessage | ||
getCookieParams() | ServerRequestInterface | Retrieve cookies. | |
getHeaderLine($name) | aMessage | Retrieves a comma-separated string of the values for a single header. | |
getHeaders() | aMessage | Retrieves all message header values. | |
GetListeners() | aMessage | Collect every listener for this class, including those registered on its parent classes (so a subclass event is also caught by listeners of its parent event), sorted by ascending $order (ties keep … | |
getMethod() | RequestInterface | Retrieves the HTTP method of the request. | |
getOrigin() | aMessage | Get origin of the request by looking at 'Origin', then 'Referer', then 'Sender' in the request's headers. | |
getProtocolVersion() | aMessage | Retrieves the HTTP protocol version as a string. | |
getQueryParams() | ServerRequestInterface | Retrieve query string arguments. | |
getUploadedFiles() | ServerRequestInterface | Retrieve normalized file upload data. | |
getUserAgent() | aMessage | ||
HasListener($handler) | aMessage | ||
isHTML() | aMessage | ||
isIe() | aMessage | ||
isIphone() | aMessage | ||
isJSON() | aMessage | ||
isMac() | aMessage | ||
isMobile() | aMessage | ||
isWindows() | aMessage | ||
jsonSerialize() | JsonSerializable | ||
RemoveListener($handler) | aMessage | Remove the last added handler from the listeners. | |
Send($args) | aMessage | Construct a new instance of this class with $args, then dispatch it to every listener. | |
setCacheControl($cache, $pragma) | aMessage | Set the Cache-Control header (and, optionally, the legacy Pragma header alongside it). | |
setContentType($type, $charset) | aMessage | Set the Content-Type header, appending a charset parameter (unless $charset is null/empty). | |
setExpires($time) | aMessage | Set the Expires header from a unix timestamp, formatted as an RFC 7231 HTTP-date. | |
SetListenerOrder($handler, $order) | aMessage | Change the order of an already-registered listener, whether added directly via AddListener or indirectly via ConnectListeners (which also stores its [$obj, $methodName] callables here). | |
withAddedHeader($name, $value) | aMessage | Return an instance with the specified header appended with the given value. | |
withBody($body) | MessageInterface | Return an instance with the specified message body. | |
withCacheControl($cache, $pragma) | aMessage | Set cache control of a clone. | |
withContentType($type, $charset) | aMessage | Set content type of a clone. | |
withCookieParams($cookies) | ServerRequestInterface | Return an instance with the specified cookies. | |
withExpires($time) | aMessage | Set cache expire date of a clone. | |
withHeader($name, $value) | aMessage | Return an instance with the provided value replacing the specified header. | |
withHeaders($headers, $reset) | aMessage | Return a clone with every header in $headers set (through tWithHeaders::setHeader, so each value replaces any existing one for the same header name). | |
withMethod($method) | RequestInterface | Return an instance with the provided HTTP method. | |
withoutHeader($name) | aMessage | Return an instance without the specified header. | |
withProtocolVersion($version) | aMessage | Return an instance with the specified HTTP protocol version. | |
withQueryParams($query) | ServerRequestInterface | Return an instance with the specified query string arguments. | |
withUploadedFiles($uploadedFiles) | ServerRequestInterface | Create a new instance with the specified uploaded files. |