Iterators to list all the PHP classes within a directory
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitignore
LICENSE
README.md
composer.json

README.md

DirectoryClassesIterator

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.

Usage

<?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');

Installation

This library is available through Packagist and can be installed using Composer:

composer require codeinc/directory-classes-iterator

License

The library is published under the MIT license (see LICENSE file).