composer require ottosmops/hash
use Ottosmops\Hash\Hash;
$hash = New Hash(); // you can pass an algorithm into the constructor
$hash->createManifest($dir);
if (!$hash->verifyManifest($dir . 'manifest')) {
print_r($this->messages);
} else {
echo sprintf('All files in %s have correct checksums ', $hash->manifest);
}
You can pass a filename to the createManifest
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 Hash();
$md5->createManifest($dir, "myfilename", false);
The MIT License (MIT). Please see License File for more information.