Skip to content

KrzysztofMoskalik/ClassLoader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Class Loader

This is a simple tool to get class object from given directory.

Usage

Basic usage:

$loader = new ClassLoader();
$objects = $loader->loadClassesFromDirectory(
    __DIR__ . '/src/'
);

This will return objects from all classes that exists in ./src directory.

If your classes needed some _construct arguments, you can pass them as second argument.

Third argument is used for filtering returned objects base on instanceof function, so you can only get children of given class or those implementing specified interface.