krzysztofzylka / file
File and directory library
1.0.6
2025-07-19 20:52 UTC
Requires
- php: >=8.0
- ext-fileinfo: *
README
composer require krzysztofzylka/file
Methods
Repair path
\Krzysztofzylka\File\File::repairPath('path')
Create directory
Permission 0755 is default
\Krzysztofzylka\File\File::mkdir('path', 0755)
or
\Krzysztofzylka\File\File::mkdir(['path', 'path2'])
Remove
\Krzysztofzylka\File\File::unlink('path')
Recursive scan directory
\Krzysztofzylka\File\File::scanDir('directory path')
Create file
\Krzysztofzylka\File\File::touch('path', 'value') //value is not required
Copy file
\Krzysztofzylka\File\File::copy('source path', 'destination path')
Copy directory
\Krzysztofzylka\File\File::copyDirectory('source path', 'destination path');
Get file extension
\Krzysztofzylka\File\File::getExtension('file path')
Get file content type
\Krzysztofzylka\File\File::getContentType('file extension')
Get file mime type
\Krzysztofzylka\File\File::getMimeType('file path')
Validations
File size validation
\Krzysztofzylka\File\Validation::size('file size in bytes or file path', 'allowed file size in mb')
File mime type
\Krzysztofzylka\File\Validation::mimeType('file path', ['allowed mime type list'])