Class QueryString
Query string object to handle managing query string parameters and aggregating those parameters together as a string.
- Guzzle\Common\Collection implements ArrayAccess, IteratorAggregate, Countable, Guzzle\Common\ToArrayInterface
-
Guzzle\Http\QueryString
Methods summary
-
public staticfromString ( string $query )Parse a query string into a QueryString object
-
public__toString ( )Convert the query string parameters to a query string string
-
publicgetFieldSeparator ( )Get the query string field separator
-
publicgetValueSeparator ( )Get the query string value separator
-
publicgetUrlEncoding ( )Returns the type of URL encoding used by the query string
-
publicisUrlEncoding ( )Returns true or false if using URL encoding
-
publicsetAggregator ( Guzzle\Http\QueryAggregator\QueryAggregatorInterface $aggregator = null )Provide a function for combining multi-valued query string parameters into a single or multiple fields
-
publicuseUrlEncoding ( bool|string $encode )Set whether or not field names and values should be rawurlencoded
-
publicsetFieldSeparator ( string $separator )Set the query string separator
-
publicsetValueSeparator ( string $separator )Set the query string value separator
-
publicurlEncode ( )Returns an array of url encoded field names and values
-
publicencodeValue ( string $value )URL encodes a value based on the url encoding type of the query string object
-
protectedprepareData ( array $data )Url encode parameter data and convert nested query strings into a flattened hash.
Methods detail
Parse a query string into a QueryString object
Parameters
- $query
string
$query Query string to parse
Returns
Convert the query string parameters to a query string string
Returns
stringThrows
Get the query string field separator
Returns
stringGet the query string value separator
Returns
stringReturns the type of URL encoding used by the query string
One of: false, "RFC 3986", or "application/x-www-form-urlencoded"
Returns
boolean|stringReturns true or false if using URL encoding
Returns
boolean
public
Guzzle\Http\QueryString
setAggregator( Guzzle\Http\QueryAggregator\QueryAggregatorInterface $aggregator = null )
Provide a function for combining multi-valued query string parameters into a single or multiple fields
Parameters
- $aggregator
null|Guzzle\Http\QueryAggregator\QueryAggregatorInterface
$aggregator Pass in a QueryAggregatorInterface object to handle converting deeply nested query string variables into a flattened array. Pass null to use the default PHP style aggregator. For legacy reasons, this function accepts a callable that must accepts a $key, $value, and query object.
Returns
See
Set whether or not field names and values should be rawurlencoded
Parameters
- $encode
boolean|string
$encode Set to TRUE to use RFC 3986 encoding (rawurlencode), false to disable encoding, or form_urlencoding to use application/x-www-form-urlencoded encoding (urlencode)
Returns
Set the query string separator
Parameters
- $separator
string
$separator The query string separator that will separate fields
Returns
Set the query string value separator
Parameters
- $separator
string
$separator The query string separator that will separate values from fields
Returns
Returns an array of url encoded field names and values
Returns
arrayURL encodes a value based on the url encoding type of the query string object
Parameters
- $value
string
$value Value to encode
Returns
stringUrl encode parameter data and convert nested query strings into a flattened hash.
Parameters
- $data
array
$data The data to encode
Returns
arrayReturns an array of encoded values and keys
Methods inherited from Guzzle\Common\Collection
__construct(),
add(),
clear(),
count(),
filter(),
fromConfig(),
get(),
getAll(),
getIterator(),
getKeys(),
getPath(),
hasKey(),
hasValue(),
keySearch(),
map(),
merge(),
offsetExists(),
offsetGet(),
offsetSet(),
offsetUnset(),
overwriteWith(),
remove(),
replace(),
set(),
setPath(),
toArray()
Magic methods summary
Constants summary
string |
RFC_3986 |
'RFC 3986' |
#
Used to URL encode with rawurlencode |
string |
FORM_URLENCODED |
'application/x-www-form-urlencoded' |
#
Used to encode with urlencode |
string |
BLANK |
"_guzzle_blank_" |
#
Constant used to create blank query string values (e.g. ?foo) |
Properties summary
protected
string
|
$fieldSeparator |
#
The query string field separator (e.g. '&') |
protected
string
|
$valueSeparator |
#
The query string value separator (e.g. '=') |
protected
boolean
|
$urlEncode |
#
URL encode fields and values |
protected
|
$aggregator |