create and verify hash files (manifests)

v1.2.0 2020-06-30 08:36 UTC

This package is auto-updated.

Last update: 2024-12-10 16:52:56 UTC


README

Software License Latest Stable Version Build Status SensioLabsInsight Packagist Downloads

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.