| 1 |
# File Util |
| 2 |
|
| 3 |
[](https://github.com/rosell-dk/file-util/actions/workflows/php.yml](https://github.com/rosell-dk/file-util/actions/workflows/php.yml](https://github.com/rosell-dk/file-util/actions/workflows/php.yml) |
| 4 |
[](https://github.com/rosell-dk/file-util/blob/master/LICENSE](https://github.com/rosell-dk/file-util/blob/master/LICENSE](https://github.com/rosell-dk/file-util/blob/master/LICENSE) |
| 5 |
[](http://little-b.it/file-util/code-coverage/coverage/index.html](http://little-b.it/file-util/code-coverage/coverage/index.html](http://little-b.it/file-util/code-coverage/coverage/index.html) |
| 6 |
[](https://packagist.org/packages/rosell-dk/file-util](https://packagist.org/packages/rosell-dk/file-util](https://packagist.org/packages/rosell-dk/file-util) |
| 7 |
[](https://php.net](https://php.net](https://php.net) |
| 8 |
|
| 9 |
Just a bunch of handy methods for dealing with files and paths: |
| 10 |
|
| 11 |
|
| 12 |
- *FileExists::fileExists($path)*:\ |
| 13 |
A well-behaved version of *file_exists* that throws upon failure rather than emitting a warning |
| 14 |
|
| 15 |
- *FileExists::fileExistsTryHarder($path)*:\ |
| 16 |
Also well-behaved. Tries FileExists::fileExists(). In case of failure, tries exec()-based implementation |
| 17 |
|
| 18 |
- *PathValidator::checkPath($path)*:\ |
| 19 |
Check if path looks valid and doesn't contain suspecious patterns |
| 20 |
|
| 21 |
- *PathValidator::checkFilePathIsRegularFile($path)*:\ |
| 22 |
Check if path points to a regular file (and doesnt match suspecious patterns) |
| 23 |
|