art4es / finder
dev-master
2019-09-20 06:52 UTC
Requires
- php: >=7.2
- ext-fileinfo: *
- ext-yaml: *
Requires (Dev)
- phpunit/phpunit: ^8.3
This package is auto-updated.
Last update: 2025-06-20 19:49:30 UTC
README
Installation: "composer require art4es/finder"
Works perfect with absolute paths and paths relative to usage location.
Usage:
$file = new File('path/to/file.txt'); $strategy = new SubstringSearchingStrategy('searchingWord'); $validatorsProvider = new YamlValidatorsProvider('path/to/config.yaml'); //if you need validate file $finder = new Finder($file, $strategy, $validatorsProvider);
config.yaml example:
mime_types: - 'text/plain' - 'application/json' extension: - 'bmp' - 'jpeg' file_size: min: 10 max: 60
Position of validators in the config file affects to the order of validation.
There are 3 configurable Validators out-of-the-box:
- ExtensionValidator
- FileSizeValidator
- MimeTypeValidator