PHP code example of vincepare / dirscan

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

    

vincepare / dirscan example snippets




use Vincepare\DirScan\DirScan;
use Vincepare\DirScan\Reporter;

class MyReporter extends Reporter
{
    public $files = [];
    
    public function push($node, DirScan $scanner)
    {
        $this->files[] = $node['path'];
    }
}

$settings = ['flat' => true];
$reporter = new MyReporter();
$scanner = new DirScan($settings, $reporter);
$scanner->scan('/tmp');
print_r($reporter->files);