| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Discover PHP classes in your project.
This project aim is to offer a set of classes enabling classes/interface/trait discovery in your own project.
Currently, the project contains only one implementation based on scanning files.
The GlobClassExplorer will look for all classes in a given namespace.
$explorer = new GlobClassExplorer('\\Some\\Namespace\\', $psr16Cache, $cacheTtl);
$classes = $explorer->getClasses();
// Will return: ['Some\Namespace\Foo', 'Some\Namespace\Bar', ...]This explorer:
By default, GlobClassExplorer will load classes recursively in sub-namespaces. You can prevent it to load classes recursively by passing false to the 5th parameter:
$explorer = new GlobClassExplorer('\\This\\Namespace\\Only\\', $psr16Cache, $cacheTtl, null, false);You can also get a class map using the getClassMap method. A class map is an array associating the name of the classes found (in key), to the file they are linked to (the real path of the file).
$classMap = $explorer->getClassMap();
foreach ($classMap as $class => $file) {
echo 'Class '.$class.' found in file '.$file;
}| Back | FazBrowse Home | New Git URL |