zendframework/zend-validator
Powerful validation library from Zend Framework for PHP apps. Provides a wide range of reusable validators, input filtering, and custom rule support with clear error messages. Integrates easily into forms and domain validation workflows.
Zend\Validator\File\Crc32 allows you to validate if a given file's hashed
contents matches the supplied crc32 hash(es). It is subclassed from the Hash
validator to provide a validator that only supports the crc32
algorithm.
Requires the hash extension
This validator requires the PHP Hash extension with the
crc32algorithm.
The following options are supported:
hash: Single string hash to test the file against, or array of filename/hash
pairs.// Does file have the given hash?
$validator = new \Zend\Validator\File\Crc32('3b3652f');
// Or, check file against multiple hashes
$validator = new \Zend\Validator\File\Crc32(['3b3652f', 'e612b69']);
// Perform validation with file path
if ($validator->isValid('./myfile.txt')) {
// file is valid
}
getCrc32() : array
Returns an array of all currently registered hashes to test against.
addCrc32(string|array $options) : void
Add a single hash to test against, or a set of filename/hash pairs to test against.
setCrc32(string|array $options): void
Overwrite the current list of registered hashes with the one(s) provided.
How can I help you explore Laravel packages today?