PHP code example of dshafik / bag

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

    

dshafik / bag example snippets


use Bag\Bag;

readonly class MyValue extends Bag {
    public function __construct(
        public string $name,
        public int $age,
    ) {
    }
}

$value = MyValue::from([
    'name' => 'Davey Shafik',
    'age' => 40,
]);