PHP IO is a small library built to work with directories and folders.
<?php
use Philasearch\IO\Directory as Directory;
use Philasearch\IO\File as File;
$dir = new Directory( '/path/to/directory' );
$files = $dir->getFiles(); // returns an array of files
foreach ( $files as $file )
{
$file->readFile(); // returns the file contents as a string
$file->getPath(); // returns the file path
$file->getName(); // returns the file name
}