Package
parameterbag
A flexible parameter bag in place of standard arrays on PHP classes
2.0.0317,943 downloads5 stars
Parameter Bag
A flexible parameter bag in place of standard arrays on PHP classes
Install
Via Composer
$ composer require juststeveking/parameterbagUsage
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); }}Related
More Packages
Same subject
In other formats
The PSR Standards You Are Probably Ignoring
Five PSR standards that most PHP developers skip. Master them and write code that works anywhere, tested easily, and tied to nothing.
PHP & Laravel
VideoLet's Build in Public with JustSteveKing: Creating a Unified Event Tracker
🚀 Welcome to "Let's Build in Public" with JustSteveKing! In this exciting livestream series, we're diving into the world of startup development, taking on the challenge of building a dynamic applicat
PHP & Laravel