PHP code example of rusakov92 / simple-file-search
1. Go to this page and download the library: Download rusakov92/simple-file-search 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/ */
rusakov92 / simple-file-search example snippets
$simpleFileSearch = new SimpleFileSearch('/path/to/base/directory');
/** @var \Iterator $result */
$result = $simpleFileSearch
->contain('#sentence I am looking for#')
->contain('#^[a-z]+$#')
->contain(['#[A-Z]+#', '#some text I know#'])
->find();
/** @var \SplFileInfo $item */
foreach ($result as $item) {
var_dump($item->getRealPath());
}