PHP code example of quillstack / parameter-bag

1. Go to this page and download the library: Download quillstack/parameter-bag library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

quillstack / parameter-bag example snippets


use Quillstack\ParameterBag\ParameterBag;

$bag = new ParameterBag(['page' => '2', 'sort' => 'email']);

$bag->get('page');            // '2'
$bag->get('perPage', '20');   // '20' — nothing under that name, so the default
$bag->has('sort');            // true
$bag->all();                  // ['page' => '2', 'sort' => 'email']

$bag->set('page', '3');
$bag->remove('sort');         // true, and false where there was nothing to remove

$bag->set('host', 'localhost')->set('port', 5432);