PHP code example of xp-framework / io-collections

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

    

xp-framework / io-collections example snippets


use io\collections\FileCollection;
use io\collections\iterate\{FilteredIOCollectionIterator, ExtensionEqualsFiler};
use util\cmd\Console;
use util\Filters;

$iterator= new FilteredIOCollectionIterator(
  new FileCollection('/home/thekid/multimedia'),
  Filters::allOf([new ExtensionEqualsFilter('.jpg'), new ExtensionEqualsFilter('.JPG')]), 
  true
);

foreach ($iterator as $file) {
  Console::writeLine($file);
}