PHP code example of railken / bag

1. Go to this page and download the library: Download railken/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/ */

    

railken / bag example snippets



use Railken\Bag;

# Initialization
$bag = new Bag();
$bag = new Bag(['foo' => '1']);

# Setting
$bag->set('foo', 1)->set('fee', 2);

# Getting
$bag->foo; #1
$bag->get('bar', 3); #3