PHP code example of thecodingmachine / class-explorer

1. Go to this page and download the library: Download thecodingmachine/class-explorer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

thecodingmachine / class-explorer example snippets


$explorer = new GlobClassExplorer('\\Some\\Namespace\\', $psr16Cache, $cacheTtl);
$classes = $explorer->getClasses();
// Will return: ['Some\Namespace\Foo', 'Some\Namespace\Bar', ...]

$explorer = new GlobClassExplorer('\\This\\Namespace\\Only\\', $psr16Cache, $cacheTtl, null, false);

$classMap = $explorer->getClassMap();
foreach ($classMap as $class => $file) {
    echo 'Class '.$class.' found in file '.$file;
}