Add support for array query parameters #52
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've added a feature which allows to generate URLs with array query parameters. URLs often have such parameters, so I think this feature is useful for this package.
The changes may be a bit controversial so I'm open for feedback. I think that using native PHP functions is better, since the implementation problem is already solved in them, and there's no longer a need for the
Arr
helper class.I'm not sure why these functions weren't used previously, so if there was a reason - I'd appreciate some feedback here.
The only downside I see with
parse_str
is this (details):Main changes:
http_build_query
function to cast QueryParameterBag to stringparse_str
function to parse input in QueryParameterBagfromString()
methodset()
method, in order to clearly support string and array onlyWhatever implementation fits best - I'm mostly interested in the array support itself. If there's any questions regarding it - please let me know.