This package provides two directory iterators to list PHP classes :
The iterator loads the .php
files using include_once()
and then the ReflectionClass
API to detect classes found within the loaded files.
<?php
use CodeInc\DirectoryClassesIterator\RecursiveDirectoryClassesIterator;
use CodeInc\DirectoryClassesIterator\DirectoryClassesIterator;
// recursive listing
$iterator = new RecursiveDirectoryClassesIterator('/path/to/libriaries');
// recursive listing with specific extensions
$iterator = new RecursiveDirectoryClassesIterator('/path/to/libriaries', ['php', 'phtml', 'inc']);
// non recursive listing
$iterator = new DirectoryClassesIterator('/path/to/libriaries');
This library is available through Packagist and can be installed using Composer:
composer require codeinc/directory-classes-iterator
The library is published under the MIT license (see LICENSE
file).