PHP code example of plumphp / plum-collection

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

    

plumphp / plum-collection example snippets


use Plum\PlumCollection\ItemConverter;
use Cocur\Collection\Collection;

$collection = new Collection();
$converter = new ItemConverter($collection);

$converter->convert('foobar'); // -> Cocur\Collection\Item
$collection->count(); // -> 1

use Plum\PlumCollection\ArrayItemConverter;
use Cocur\Collection\Collection;

$collection = new Collection();
$converter = new ArrayItemConverter($collection);

$converter->convert(['foo' => 'bar']); // -> Cocur\Collection\ArrayItem
$collection->count(); // -> 1