** This package is not maintained any longer. Me, I use the ottosmops/hash package instead **
composer require ottosmops/md5sum
use Ottosmops\Md5sum\Md5sum;
$md5 = New Md5sum();
$md5->createMd5sums($dir);
if (!$md5->verifyMd5sums($dir . 'md5sums')) {
print_r($this->messages);
} else {
echo sprintf('All files in %s have correct checksums ', $md5->md5sums);
}
You can pass a filename to the createMd5sums
method. The filename must be a path relative to the dir. With the third parameter you can switch off the recursive directory iterator. No subdirectories will be scanned:
$md5 = New Md5sums();
$md5->createMd5sums($dir, "myfilename", false);
The MIT License (MIT). Please see License File for more information.