Skip to main content
ArticlesProjects
Open Source Package

juststeveking/parameterbag

A flexible parameter bag in place of standard arrays on PHP classes

PHPv1.2.0· Updated 30 June 2026
Total Downloads307,452
Monthly Downloads3,407
GitHub Stars4
Source Links

Parameter Bag

Latest Version on Packagist

Total Downloads

A flexible parameter bag in place of standard arrays on PHP classes

Install

Via Composer

Terminal window
$ composer require juststeveking/parameterbag

Usage

Basic usage. Create a parameter bag from a simple array.

$parameters = ['foo' => 'bar'];
$bag = new \JustSteveKing\ParameterBag($parameters);

Create a parameter bag from a query string, please note by default the delimeter is & but this can be overridden as the second arguement should you want to use another method.

$query = \JustSteveKing\ParameterBag::fromString($request->getQuery());

A more useful example:

class Config
{
protected ParameterBag $items;
private function __construct(array $items)
{
$this->items = new ParameterBag($items);
}
public static function create(array $items) : self
{
return new self($items);
}
}