PHP code example of antikirra / find

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

    

antikirra / find example snippets




use Antikirra\Find\Find;

r');

$iterator = $finder->find(function (SplFileInfo $fileInfo) {
    return $fileInfo->getSize() === 0 ? $fileInfo : null;
});

foreach ($iterator as $realPath => $fileInfo) {
    // do stuff
}



use Antikirra\Find\Find;

kirra/PhpstormProjects')
    ->filesOnly()
    //->withExtensions(['txt', 'php'])
    //->directoriesOnly()
    //->withSoftLimit(10)
    //->withHardLimit(10000)
;

$iterator = $finder->find(function (SplFileInfo $fileInfo) {
    // files modified within the last hour
    return time() - $fileInfo->getMTime() < 3600 ? $fileInfo : null;
});

foreach ($iterator as $realPath => $fileInfo) {
    echo $realPath . ' - ' . date('Y-m-d H:i:s', $fileInfo->getMTime()) . PHP_EOL;
}

// /Users/antikirra/PhpstormProjects/find/composer.lock - 2023-05-24 21:21:46
// /Users/antikirra/PhpstormProjects/find/README.md - 2023-05-24 21:31:57
// /Users/antikirra/PhpstormProjects/find/Find.php - 2023-05-24 21:21:14
// /Users/antikirra/PhpstormProjects/find/composer.json - 2023-05-24 21:21:14
// ...