--- /dev/null
+# namespace http
+
+This is pecl_http-v2.
+
+This documentation is work-in-progress.
The http\Env module overrides PHP's builtin POST data parser to be run also if
the request method is not POST. Additionally it will handle
-```application/json``` payloads if ```ext/json``` is available. Successfully
+application/json payloads if ext/json is available. Successfully
parsed JSON will be put right into the $_POST array.
## Constants:
-> None.
+None.
## Properties:
-* ```protected $query = NULL```
+* protected $query = NULL
The request's query parameters. ($_GET)
-* ```protected $form = NULL```
+* protected $form = NULL
The request's form parameters. ($_POST)
-* ```protected $files = NULL```
+* protected $files = NULL
The request's form uploads. ($_FILES)
+# void http\Env\Request::__construct(void)
+
+Instantiate the server's current HTTP request.
+
+## Params:
+
+None.
## Parameters:
-* Optional ```string $body_class_name```
+* Optional string $body_class_name
A user class extending http\Body.
## Returns:
-* ```http\Message\Body``` instance representing the request body
+* http\Message\Body instance representing the request body
## Throws:
## Parameters:
-* Optional ```string $header_name```
+* Optional string $header_name
The key of a header to retrieve.
## Returns:
-* ```NULL```, if $header_name was not found
-* ```string```, the compound header when $header_name was found
-* ```array``` of all headers if $header_name was not specified
+* NULL, if $header_name was not found
+* string, the compound header when $header_name was found
+* array of all headers if $header_name was not specified
## Parameters:
-> None.
+None.
## Returns:
-* ```int```, the HTTP response code.
+* int, the HTTP response code.
## Parameters:
-* Optional ```string $header_name```
+* Optional string $header_name
The name of the response header to retrieve.
## Returns:
-* ```string```, the compound value of the response header to send
-* ```NULL```, if the header was not found
-* ```array```, of all response headers, if $header_name was not specified
+* string, the compound value of the response header to send
+* NULL, if the header was not found
+* array, of all response headers, if $header_name was not specified
## Parameters:
-> None.
+None.
## Returns:
-* ```array``` mapping of the form \[
+* array mapping of the form \[
...
- ```int $code``` => ```string $status```
+ int $code => string $status
...
\]
## Parameters:
-* ```int $code```
+* int $code
The HTTP response code to get the string representation for.
## Returns:
-* ```string```, the HTTP response status message
-* empty ```string```, if no message for this code was found
+* string, the HTTP response status message
+* empty string, if no message for this code was found
## Params:
-* ```string $params```
+* string $params
HTTP header parameter's value to negotiate.
-* ```array $supported```
+* array $supported
List of supported negotiation operands.
-* Optional ```string $prim_typ_sep```
+* Optional string $prim_typ_sep
A "primary type separator", i.e. that would be a hyphen for content language negotiation (en-US, de-DE, etc.).
-* Optional reference ```array &$result```
+* Optional reference array &$result
Out parameter recording negotiation results.
## Returns:
-* ```NULL```, if negotiation fails.
-* ```string```, the closest match negotiated, or the default (first entry of $supported).
+* NULL, if negotiation fails.
+* string, the closest match negotiated, or the default (first entry of $supported).
## Params:
-* ```array $supported```
+* array $supported
List of supported content character sets.
-* Optional reference ```array &$result```
+* Optional reference array &$result
Out parameter recording negotiation results.
## Returns:
-* ```NULL```, if negotiation fails.
-* ```string```, the negotiated character set.
+* NULL, if negotiation fails.
+* string, the negotiated character set.
## Params:
-* ```array $supported```
+* array $supported
List of supported MIME content types.
-* Optional reference ```array &$result```
+* Optional reference array &$result
Out parameter recording negotiation results.
## Returns:
-* ```NULL```, if negotiation fails.
-* ```string```, the negotiated content type.
+* NULL, if negotiation fails.
+* string, the negotiated content type.
## Example:
-A client indicates his accepted MIME content types by sending an ```Accept```
-header. The static ```http\Env``` class provides a facility to negotiate the
+A client indicates his accepted MIME content types by sending an Accept
+header. The static http\Env class provides a facility to negotiate the
client's preferred content type:
<?php
## Params:
-* ```array $supported```
+* array $supported
List of supported content encodings.
-* Optional reference ```array &$result```
+* Optional reference array &$result
Out parameter recording negotiation results.
## Returns:
-* ```NULL```, if negotiation fails.
-* ```string```, the negotiated encoding.
+* NULL, if negotiation fails.
+* string, the negotiated encoding.
## Params:
-* ```array $supported```
+* array $supported
List of supported content languages.
-* Optional reference ```array &$result```
+* Optional reference array &$result
Out parameter recording negotiation results.
## Returns:
-* ```NULL```, if negotiation fails.
-* ```string```, the negotiated language.
+* NULL, if negotiation fails.
+* string, the negotiated language.
## Params:
-* ```int $code```
+* int $code
The HTTP response status code.
## Returns:
-* ```bool``` Success.
+* bool Success.
Set a response header, either replacing a prior set header, or appending the new header value, depending on $replace.
-If no $header_value is specified, or $header_value is ```NULL```, then a previously set header with the same key will be deleted from the list.
+If no $header_value is specified, or $header_value is NULL, then a previously set header with the same key will be deleted from the list.
-If $response_code is not ```0```, the response status code is updated accordingly.
+If $response_code is not 0, the response status code is updated accordingly.
## Parameters:
-* ```string $header_name```, the name of the response header.
-* Optional ```mixed $header_value```, the header value.
-* Optional ```int $response_code```, any HTTP response status code to set.
-* Optional ```bool $replace```, whether to replace a previously set response header with the same name.
+* string $header_name, the name of the response header.
+* Optional mixed $header_value, the header value.
+* Optional int $response_code, any HTTP response status code to set.
+* Optional bool $replace, whether to replace a previously set response header with the same name.
## Returns:
-* ```bool``` Success.
+* bool Success.
## Constants:
-* ```MATCH_LOOSE```
+* MATCH_LOOSE
None of the following match constraints applies.
-* ```MATCH_CASE```
+* MATCH_CASE
Perform case sensitive matching.
-* ```MATCH_WORD```
+* MATCH_WORD
Match only on word boundaries (according by CTYPE alpha-numeric).
-* ```MATCH_FULL```
+* MATCH_FULL
Match the complete string.
-* ```MATCH_STRICT```
- Case sensitively match the full string (same as ```MATCH_CASE|MATCH_FULL```).
+* MATCH_STRICT
+ Case sensitively match the full string (same as MATCH_CASE|MATCH_FULL).
## Properties:
-* ```public $name = NULL```
+* public $name = NULL
The name of the HTTP header.
-* ```public $value = NULL```
+* public $value = NULL
The value of the HTTP header.
## Params:
-* Optional ```string $name```
+* Optional string $name
The HTTP header name.
-* Optional ```mixed $value```
+* Optional mixed $value
The value of the header.
# Throws:
## Params:
-> None.
+None.
## Returns:
-* ```string```, the serialized form of the HTTP header (i.e. "Name: value").
+* string, the serialized form of the HTTP header (i.e. "Name: value").
## Params:
-* Optional ```mixed $ps```
+* Optional mixed $ps
The parameter separator(s).
-* Optional ```mixed $as```
+* Optional mixed $as
The argument separator(s).
-* Optional ```mixed```
+* Optional mixed
The value separator(s).
-* Optional ```int $flags```
+* Optional int $flags
The modus operandi. See http\Params constants.
## Returns:
-* ```http\Params``` instance
+* http\Params instance
## Params:
-* ```string $value```
+* string $value
The comparison value.
-* Optional ```int $flags```
+* Optional int $flags
The modus operandi. See http\Header constants.
## Returns:
-* ```bool```, whether $value matches the header value according to $flags.
+* bool, whether $value matches the header value according to $flags.
Negotiate the header's value against a list of supported values in $supported.
Negotiation operation is adopted according to the header name, i.e. if the
-header being negotiated is ```Accept```, then a slash is used as primary type
-separator, and if the header is ```Accept-Language``` respectively, a hyphen is
+header being negotiated is Accept, then a slash is used as primary type
+separator, and if the header is Accept-Language respectively, a hyphen is
used instead.
> ***NOTE:*** The first elemement of $supported serves as a default if no operand matches.
## Params:
-* ```array $supported```
+* array $supported
The list of supported values to negotiate.
-* Optional reference ```array &$result```
+* Optional reference array &$result
Out parameter recording the negotiation results.
## Returns:
-* ```NULL```, if negotiation fails.
-* ```string```, the closest match negotiated, or the default (first entry of $supported).
+* NULL, if negotiation fails.
+* string, the closest match negotiated, or the default (first entry of $supported).
## Params:
-* ```string $header```
+* string $header
The complete string of headers.
-* Optional ```string $header_class```
+* Optional string $header_class
A class extending http\Header.
## Returns:
-* ```array``` of parsed headers, where the elements are instances of $header_class if specified.
+* array of parsed headers, where the elements are instances of $header_class if specified.
## Params:
-> None.
+None.
## Returns:
-* ```string```, serialized representation of HTTP header (i.e. "Name: value")
+* string, serialized representation of HTTP header (i.e. "Name: value")
## Params:
-> None.
+None.
## Returns:
-* ```string```, the serialized form of the HTTP header (i.e. "Name: value").
+* string, the serialized form of the HTTP header (i.e. "Name: value").
## Params:
-* ```string $serialized```
+* string $serialized
The serialized HTTP header (i.e. "Name: value")
## Constants:
-* ```DEF_PARAM_SEP```
+* DEF_PARAM_SEP
The default parameter separator (",").
-* ```DEF_ARG_SEP```
+* DEF_ARG_SEP
The default argument separator (";").
-* ```DEF_VAL_SEP```
+* DEF_VAL_SEP
The default value separator ("=").
-* ```COOKIE_PARAM_SEP```
+* COOKIE_PARAM_SEP
TBD
-* ```PARSE_RAW```
+* PARSE_RAW
Do not interpret the parsed parameters.
-* ```PARSE_DEFAULT```
+* PARSE_DEFAULT
Interpret input as default formatted parameters.
-* ```PARSE_URLENCODED```
+* PARSE_URLENCODED
Urldecode single units of parameters, arguments and values.
-* ```PARSE_DIMENSION```
+* PARSE_DIMENSION
Parse sub dimensions indicated by square brackets.
-* ```PARSE_QUERY```
+* PARSE_QUERY
Parse URL query string (same as http\Params::PARSE_URLENCODED|http\Params::PARSE_DIMENSION).
## Properties:
-* ```public $params = NULL```
+* public $params = NULL
The (parsed) parameters.
-* ```public $param_sep = http\Header::DEF_PARAM_SEP```
+* public $param_sep = http\Params::DEF_PARAM_SEP
The parameter separator(s).
-* ```public $arg_sep = http\Header::DEF_ARG_SEP```
+* public $arg_sep = http\Params::DEF_ARG_SEP
The argument separator(s).
-* ```public $val_sep = http\Header::DEF_VAL_SEP```
+* public $val_sep = http\Params::DEF_VAL_SEP
The value separator(s).
-* ```public $flags = http\Params::PARSE_DEFAULT```
+* public $flags = http\Params::PARSE_DEFAULT
The modus operandi of the parser. See http\Params::PARSE_* constants.
## Params:
-* Optional ```mixed $params```
+* Optional mixed $params
Pre-parsed parameters or a string to be parsed.
-* Optional ```mixed $ps```
+* Optional mixed $ps
The parameter separator(s).
-* Optional ```mixed $as```
+* Optional mixed $as
The argument separator(s).
-* Optional ```mixed $vs```
+* Optional mixed $vs
The value separator(s).
-* Optional ```int $flags```
+* Optional int $flags
The modus operandi. See http\Params::PARSE_* constants.
## Throws:
## Params:
-> None.
+None.
## Returns:
-* ```string``` version of the parameters.
+* string version of the parameters.
## Params:
-* ```string $name```
+* string $name
The offset to look after.
## Returns:
-* ```bool``` Existence.
+* bool Existence.
## Params:
-* ```string $name```
+* string $name
The offset to retrieve.
## Returns:
-* ```mixed```, contents at offset.
+* mixed, contents at offset.
## Params:
-* ```string $name```
+* string $name
The offset to modify.
-* ```mixed $value```
+* mixed $value
The value to set.
## Params:
-* ```string $name```
+* string $name
The offset to delete.
## Params:
-> None.
+None.
## Returns:
-* ```array``` of paramters.
+* array of paramters.
## Params:
-> None.
+None.
## Returns:
-* ```string``` version of the parameters.
+* string version of the parameters.