PHP code example of norris1z / zing_finder

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

    

norris1z / zing_finder example snippets




ng\Finder\Exceptions\DirectoryException;
use Zing\Finder\Finder;

try {

   //Path to the directory can be passed through the constructor or the setDirectory method.
    $file = new Finder('foo/bar/dir');
    
    //setting path to the directory through setDirectory
    $file->setDirectory('foo/bar/dir');
    
    // this scans through a directory 
    // it accepts a boolean parameter which is set to false by default
    // to scan through the directory and subdirectories in the directory set parameter to true
    var_dump($find->search()); // prints all files in the directory 
    var_dump($find->search(true)); //prints files in both directories and subdirectories 
    
    // finds and displays files in a directory given an extentsion 
    var_dump($find->findFilesWithExtension('extension')->show());
    
    ///dir');
    
}catch (DirectoryException $e){
    echo $e->getMessage();
}