crwlr/query-string
A library for convenient handling of query strings used in HTTP requests.
v1.0.3
7.1M downloads/mo
#1286 most downloaded on Packagist
crwlrsoft/query-string
What this package is like to depend on
Last release 3 years ago
no release in 18 months
Ships fairly regularly
a new release about every 5 months
Most releases are documented
notes for 3 of 4 stable releases
Nothing withdrawn
no release was ever pulled
4 years old
4 releases · first in 2022
0 releases in the last 12 months
see the full history below
Release timeline
4 releases · Jun 2022 to Apr 2023
2023
2024
2025
2026
Releases
latest 4-
v1.0.312 Apr 2023Release notes
Open source →Fixed
- Fixes an issue introduced in v1.0.2. When creating an instance from string, it's containing an array and the brackets are encoded (like
filter%5Bfoo%5D%5B%5D=1&filter%5Bfoo%5D%5B%5D=2), the method trying to fix duplicate keys without brackets added another array level (likefilter[foo][]tofilter[foo][][]). This is fixed with this release.
Release notes
Open source →Fixed
- Fixes an issue introduced in v1.0.2. When creating an instance from string, it's containing an array and the brackets are encoded (like
filter%5Bfoo%5D%5B%5D=1&filter%5Bfoo%5D%5B%5D=2), the method trying to fix duplicate keys without brackets added another array level (likefilter[foo][]tofilter[foo][][]). This is fixed with this release.
- Fixes an issue introduced in v1.0.2. When creating an instance from string, it's containing an array and the brackets are encoded (like
-
v1.0.212 Apr 2023Release notes
Open source →Fixed
- Duplicate keys without array notation (like
foo=bar&foo=baz) are now also interpreted as array (likefoo[]=bar&foo[]=baz). This is considered a bugfix because:- Previously
foo=bar&foo=bazbecamefoo=baz, which is most likely unwanted behavior. - Of course, such query strings should preferably be written using the array notation (
[]), but if such a query is written without the brackets, the intention is either that it should be an array, or it's a mistake. If it is a mistake, the probability to notice it is higher, when the result contains all values instead of only the last one. - As this library is also part of the crwlr crawling library and there are servers intentionally using the syntax without brackets (e.g. google https://fonts.googleapis.com/css2?family=Baloo&family=Roboto) it's better to interpret it as an array.
- Previously
Release notes
Open source →Fixed
- Duplicate keys without array notation (like
foo=bar&foo=baz) are now also interpreted as array (likefoo[]=bar&foo[]=baz). This is considered a bugfix because:- Previously
foo=bar&foo=bazbecamefoo=baz, which is most likely unwanted behavior. - Of course, such query strings should preferably be written using the array notation (
[]), but if such a query is written without the brackets, the intention is either that it should be an array, or it's a mistake. If it is a mistake, the probability to notice it is higher, when the result contains all values instead of only the last one. - As this library is also part of the crwlr crawling library and there are servers intentionally using the syntax without brackets (e.g. google https://fonts.googleapis.com/css2?family=Baloo&family=Roboto) it's better to interpret it as an array.
- Previously
- Duplicate keys without array notation (like
-
v1.0.130 Jan 2023Release notes
Open source →Fixed
- When creating a
Queryfrom string, and it contains empty key value parts, like&foo=bar,foo=bar&orfoo=bar&&baz=quz, the unnecessary&characters are removed in the string version now. For example,&foo=barpreviously lead to$instance->toString()returning&foo=barand now it returnsfoo=bar. - To assure that there can't be differences in the array and string versions returned by the
Queryclass, no matter if the instance was created from string or array, the library now first converts incoming values back and forth. So, when an instance is created from string, it first converts it to an array and then again back to a string and vice versa when an instance is created from an array. Some Examples being fixed by this:- From string
foo=bar:- Before: toString():
+++foo=bar++, toArray():['foo' => 'bar ']. - Now: toString():
foo=bar++, toArray():['foo' => 'bar ']
- Before: toString():
- From string
foo[bar] [baz]=bar- Before: toString():
foo%5Bbar%5D+%5Bbaz%5D=bar, toArray():['foo' => ['bar' => 'bar']]. - Now: toString():
foo%5Bbar%5D=bar, toArray():'[foo' => ['bar' => 'bar']].
- Before: toString():
- From string
foo[bar][baz][]=bar&foo[bar][baz][]=foo- Before: toString():
foo%5Bbar%5D%5Bbaz%5D%5B%5D=bar&foo%5Bbar%5D%5Bbaz%5D%5B%5D=foo, toArray():['foo' => ['bar' => ['baz' => ['bar', 'foo']]]]. - Now: toString():
foo%5Bbar%5D%5Bbaz%5D%5B0%5D=bar&foo%5Bbar%5D%5Bbaz%5D%5B1%5D=foo, toArray():['foo' => ['bar' => ['baz' => ['bar', 'foo']]]].
- Before: toString():
- From string
option- Before: toString():
option, toArray():['option' => ''] - Now: toString():
option=, toArray():['option' => '']
- Before: toString():
- From string
foo=bar=bar==- Before: toString():
foo=bar=bar==, toArray():[['foo' => 'bar=bar=='] - Now: toString():
foo=bar%3Dbar%3D%3D, toArray():[['foo' => 'bar=bar==']
- Before: toString():
- From string
sum=10%5c2%3d5- Before: toString():
sum=10%5c2%3d5, toArray():[['sum' => '10\\2=5'] - Now: toString():
sum=10%5C2%3D5, toArray():[['sum' => '10\\2=5']
- Before: toString():
- From string
foo=%20+bar- Before: toString():
foo=%20+bar, toArray():['foo' => ' bar'] - Now: toString():
foo=++bar, toArray():['foo' => ' bar']
- Before: toString():
- From string
- Maintain the correct order of key value pairs when converting query string to array.
Release notes
Open source →Fixed
- When creating a
Queryfrom string, and it contains empty key value parts, like&foo=bar,foo=bar&orfoo=bar&&baz=quz, the unnecessary&characters are removed in the string version now. For example,&foo=barpreviously lead to$instance->toString()returning&foo=barand now it returnsfoo=bar. - To assure that there can't be differences in the array and string versions returned by the
Queryclass, no matter if the instance was created from string or array, the library now first converts incoming values back and forth. So, when an instance is created from string, it first converts it to an array and then again back to a string and vice versa when an instance is created from an array. Some Examples being fixed by this:- From string
foo=bar:- Before: toString():
+++foo=bar++, toArray():['foo' => 'bar ']. - Now: toString():
foo=bar++, toArray():['foo' => 'bar ']
- Before: toString():
- From string
foo[bar] [baz]=bar- Before: toString():
foo%5Bbar%5D+%5Bbaz%5D=bar, toArray():['foo' => ['bar' => 'bar']]. - Now: toString():
foo%5Bbar%5D=bar, toArray():'[foo' => ['bar' => 'bar']].
- Before: toString():
- From string
foo[bar][baz][]=bar&foo[bar][baz][]=foo- Before: toString():
foo%5Bbar%5D%5Bbaz%5D%5B%5D=bar&foo%5Bbar%5D%5Bbaz%5D%5B%5D=foo, toArray():['foo' => ['bar' => ['baz' => ['bar', 'foo']]]]. - Now: toString():
foo%5Bbar%5D%5Bbaz%5D%5B0%5D=bar&foo%5Bbar%5D%5Bbaz%5D%5B1%5D=foo, toArray():['foo' => ['bar' => ['baz' => ['bar', 'foo']]]].
- Before: toString():
- From string
option- Before: toString():
option, toArray():['option' => ''] - Now: toString():
option=, toArray():['option' => '']
- Before: toString():
- From string
foo=bar=bar==- Before: toString():
foo=bar=bar==, toArray():[['foo' => 'bar=bar=='] - Now: toString():
foo=bar%3Dbar%3D%3D, toArray():[['foo' => 'bar=bar==']
- Before: toString():
- From string
sum=10%5c2%3d5- Before: toString():
sum=10%5c2%3d5, toArray():[['sum' => '10\\2=5'] - Now: toString():
sum=10%5C2%3D5, toArray():[['sum' => '10\\2=5']
- Before: toString():
- From string
foo=%20+bar- Before: toString():
foo=%20+bar, toArray():['foo' => ' bar'] - Now: toString():
foo=++bar, toArray():['foo' => ' bar']
- Before: toString():
- From string
- Maintain the correct order of key value pairs when converting query string to array.
- When creating a
-
v1.0.001 Jun 2022Nothing published for this version