2017 © Pedro Peláez
 

library query-stringer

A simple query string helper to modify, get, and replace query strings.

image

mikefunk/query-stringer

A simple query string helper to modify, get, and replace query strings.

  • Friday, August 16, 2013
  • by mikedfunk
  • Repository
  • 1 Watchers
  • 2 Stars
  • 121 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Build Status Coverage Status, (*1)

QueryStringer

A simple query string helper that will let you:, (*2)

  • get a query string with key/values added
  • get a query string with keys removed (blacklist)
  • get a query string with only a subset of keys (whitelist)
  • combine any of these
  • use the helper to assemble a new query string
  • get the result as an array
  • get the result as a string

Installation

Add this to your composer.json:, (*3)

"mikefunk/query-stringer": "dev-master", (*4)

then run composer update and you're ready to use query stringer!, (*5)

Usage

// assume the current document's query string is britney=spears&michael=jackson
$query_stringer = new MikeFunk\QueryStringer;

// returns ?michael=jackson
$query_stringer->without(['britney'])->get();

// returns ?britney=spears&michael=jackson&joe=schlabotnik
$query_stringer->with(['joe' => 'schlabotnik'])->get();

// returns array('britney' => 'spears', 'michael' => 'jackson')
$query_stringer->getArray();

// returns ?master=splinter
$query_stringer->replaceWith('master' => 'splinter')->get();

// returns ?michael=jackson
$query_stringer->only(['michael'])->get();

// if the current document's query string is not set, returns an empty string.
// no question mark.
$query_stringer->get();

The Versions

16/08 2013

dev-master

9999999-dev

A simple query string helper to modify, get, and replace query strings.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Mike Funk