A PHP implementation of URLSearchParams for handling query parameters easily.
Installation is super-easy via Composer
composer require web/url-search-paramsor add it by hand to your composer.json file.
use Web\URLSearchParams\URLSearchParams;
require 'vendor/autoload.php';$usp = new URLSearchParams();$usp = new URLSearchParams('name=foo&id=123&age=12');$usp = new URLSearchParams('?name=foo&id=123&age=12');$usp = new URLSearchParams([['name', 'foo'], ['id', 123], ['age', 12]]);$usp = new URLSearchParams(['name'=> 'foo', 'id'=> 123, 'age'=> 12]);$usp = new URLSearchParams(stdClass Object
(
[name] => foo
[id] => 123
[age] => 12
));$usp->entries();$usp->tupples();