Fork me on GitHub

Filter Parameters

There are two ways to get filter parameters. One is by using straight forward get (query string) parameters and the other is by using key/value based url structure. In this sense the following two uri’s are the same:

/sample/?my=values&are=awesome

/sample/my/value/are/awesome

With the exception of a few (predefined keys) all is permitted.

Filter parameters are parsed in a way that they are immediatly casted to the right data type. Currently this applies to strings, integers, floats, booleans and arrays.

Within a module you can get all current filter parameters by using (returns an array):

$filters = $this->getFilterParameters();

Operators

The following operators are supported:

Not
/sample/key/!thisvalue

Greater than
/sample/key/>123

Greater than or equal
/sample/key/>=123

Less than
/sample/key/<123

Less than or equal
/sample/key/<=123

Between
/sample/key/><123

Value casting

Internally, the value of parameters are checked and, when possible, cast to the right datatype.

The following examples apply:

Type Possible value Description
array item1|value2|thing3 String with | characters are cast to array
integer 42 Strings which are numeric are cast to an integer
float 42.24 Strings which are floating point decimals are cast to a floating point decimal
boolean true If a parameter is “true” or “false” it is cast as a boolean
string “A lot of characters, with maybe a |” Strings with a ” as the first and last character are always cast as a string, even when the array divider | is used.
default Just a bunch of characters Default behavior is to cast as string.