PHP code example of jasny / fqcn-reader

1. Go to this page and download the library: Download jasny/fqcn-reader 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/ */

    

jasny / fqcn-reader example snippets


use Jasny\FQCN\FQCNReader;

$reader = new FQCNReader();

$class = $reader->getClass("path/to/source.php");

use Jasny\FQCN\FQCNIterator;

$sourceFiles = glob('path/to/directory/*.php');
$sourceIterator = new ArrayIteractor($sourceFiles);

$fqcnIterator = new FQCNIterator($sourceIterator);

foreach ($fqcnIteractor as $file => $class) {
   // do something with $class
}

use Jasny\FQCN\FQCNIterator;

$directoryIterator = new RecursiveDirectoryIterator('path/to/project/');
$recursiveIterator = new RecursiveIteratorIterator($directoryIterator);
$sourceIterator = new RegexIterator($recursiveIterator, '/^.+\.php$/i', RegexIterator::GET_MATCH);

$fqcnIterator = new FQCNIterator($sourceIterator);

foreach ($fqcnIteractor as $file => $class) {
   // do something with $class
}