Download the PHP package nerd4ever/url-query without Composer
On this page you can find all versions of the php package nerd4ever/url-query. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package url-query
nerd4ever/url-query
A library to extract parameters to filter and sort.
Installation
Supported operators
Operators used in filters and your syntax
- ge value greater than or equals
ge.: test=between:3,5 (field => test, operator => between, start => 3, end => 5 )
- le value less than or equals
eg.: test=le:3 (field => test, operator => le, value => 3)
- ne value not equals
eg.: test=ne:3 (field => test, operator => ne, value => 3)
- eq value equals
eg.: test=eq:3 (field => test, operator => eq, value => 3)
- gt value greater than
eg.: test=gt:3 (field => test, operator => gt, value => 3)
- lt value less than
eg.: test=lt:5 (field => test, operator => lt, value => 5)
- regex value validate by regular expression
eg.: test=regex:[0-9] (field => test, operator => regex, values => [0-9])
- in one or more possible values (separated by commas)
eg.: test=in:3,4,5 (field => test, operator => in, values => [3,4,5])
- between values between start and end range (separated by commas).
eg.: test=between:3,5 (field => test, operator => between, start => 3, end => 5 )
- contains value anywhere
eg.: test=contains:3 (field => test, operator => contains, value => 3)
- start value at the beginning
eg.: test=start:3 (field => test, operator => start, value => 3)
- finish value at the end
eg.: test=finish:3 (field => test, operator => finish, value => 3)
- nil value null
eg.: test=nil: (field => test, operator => nil)
Sorter syntax
- test:asc (field => test, type=> asc)
- test:desc (field => test, type=> desc)
- test (field => test, type=> asc)
Limit syntax
- _limit=10 (property => _limit, value=> 10)
Offset syntax
- _limit=10 (property => _limit, value=> 10)
- _offset=1 (property => __offset, value=> 1)
QueryString example
Usage
Output example For var_export($urlQuery, true) from code above, using the QUERY_STRING ?data0=3&data1=ge:3&data2=le:3&data3=ne:3&data4=eq:3&data5=gt:3&data6=lt:3&data7=regex:[0-9]&data8=in:3,4,5&data9=between:3,5&data10=contains:3&data11=start:3&data12=finish:5&data13=nil:&_orders=data1:asc,data2:desc,data3