ottosmops / hash
create and verify hash files (manifests)
v1.2.0
2020-06-30 08:36 UTC
Requires
- php: >=7.1
Requires (Dev)
- phpunit/phpunit: ~7.5
- squizlabs/php_codesniffer: ^3.4
This package is auto-updated.
Last update: 2024-11-10 16:36:00 UTC
README
Installation
composer require ottosmops/hash
Usage
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);
License
The MIT License (MIT). Please see License File for more information.