2017 © Pedro Peláez
 

library querystring

Query String manipulation library. PHP 7.1+. No dependency, immutable, PSR-7 compliant.

image

bentools/querystring

Query String manipulation library. PHP 7.1+. No dependency, immutable, PSR-7 compliant.

  • Wednesday, November 15, 2017
  • by bpolaszek
  • Repository
  • 2 Watchers
  • 1 Stars
  • 227 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 29 % Grown

The README.md

Latest Stable Version License CI Workflow Coverage Quality Score Total Downloads, (*1)

QueryString

A lightweight, object-oriented, Query String manipulation library., (*2)

Why?

Because I needed an intuitive way to add or remove parameters from a query string, in any project., (*3)

Oh, and, I also wanted that ['foos' => ['foo', 'bar']] resolved to foos[]=foo&foos[]=bar instead of foos[0]=foo&foos[1]=bar, unlike many libraries do., (*4)

Thanks to object-oriented design, you can define the way query strings are parsed and rendered., (*5)

Usage

Simple as that:, (*6)

require_once __DIR__ . '/vendor/autoload.php';

use function BenTools\QueryString\query_string;

$qs = query_string(
    'foo=bar&baz=bat'
);
$qs = $qs->withParam('foo', 'foofoo')
    ->withoutParam('baz')
    ->withParam('ho', 'hi');

print_r($qs->getParams());
/* Array
(
    [foo] => foofoo
    [ho] => hi
) */

print $qs; // foo=foofoo&ho=hi

Documentation

Instantiation / Parsing, (*7)

Manipulate parameters, (*8)

Render as string, (*9)

Installation

PHP 7.1+ is required., (*10)

composer require bentools/querystring:^1.0, (*11)

Tests

./vendor/bin/phpunit, (*12)

License

MIT, (*13)

See also

bentools/uri-factory - A PSR-7 UriInterface factory based on your own dependencies., (*14)

bentools/pager - A simple, object oriented Pager., (*15)

bentools/where - A framework-agnostic fluent, immutable, SQL query builder., (*16)

bentools/picker - Pick a random item from an array, with weight management., (*17)

bentools/psr7-request-matcher - A PSR-7 request matcher interface., (*18)

bentools/cartesian-product - Generate all possible combinations from a multidimensionnal array., (*19)

bentools/string-combinations - A string combinations generator., (*20)

bentools/flatten-iterator - An iterator that flattens multiple iterators or arrays., (*21)

The Versions

15/11 2017

dev-master

9999999-dev

Query String manipulation library. PHP 7.1+. No dependency, immutable, PSR-7 compliant.

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

psr-7 url psr7 uri querystring query string

15/11 2017

1.0

1.0.0.0

Query String manipulation library. PHP 7.1+. No dependency, immutable, PSR-7 compliant.

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

psr-7 url psr7 uri querystring query string