Skip to content

A PHP implementation of URLSearchParams for handling query parameters easily.

License

Notifications You must be signed in to change notification settings

lazervel/URLSearchParams

Repository files navigation

PHP URLSearchParams

A PHP implementation of URLSearchParams for handling query parameters easily.

Total Downloads Latest Version

Composer Installation

Installation is super-easy via Composer

composer require web/url-search-params

or add it by hand to your composer.json file.

The Features of PHP URLSearchParams

Autoloading

use Web\URLSearchParams\URLSearchParams;
require 'vendor/autoload.php';

Creating object without parameter

$usp = new URLSearchParams();

Creating object without '?' query string

$usp = new URLSearchParams('name=foo&id=123&age=12');

Creating object with '?' query string

$usp = new URLSearchParams('?name=foo&id=123&age=12');

Creating object query paire array with iterable [name, value]

$usp = new URLSearchParams([['name', 'foo'], ['id', 123], ['age', 12]]);

Creating object with associative array [key=>value] paire

$usp = new URLSearchParams(['name'=> 'foo', 'id'=> 123, 'age'=> 12]);

Creating object with object

$usp = new URLSearchParams(stdClass Object
(
  [name] => foo
  [id] => 123
  [age] => 12
));

entries()

$usp->entries();

tupples()

$usp->tupples();

Resources

About

A PHP implementation of URLSearchParams for handling query parameters easily.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages