phant / file
Manage file easily
Installs: 1 957
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=8.2
Requires (Dev)
- friendsofphp/php-cs-fixer: 3.*
- phpstan/phpstan: 1.*
- phpunit/phpunit: 9.*
README
Requirments
PHP >= 8.1
Install
composer require phant/file
Usages
File
use Phant\File\File; $file = new File('path/filename.ext');
Get file path
$filePath = $file->getPath();
Verify if file exist file path
$fileExist = $file->exist();
Delete file
$file->delete();
Get temporary path
$temoraryDirectory = $file->getTemoraryDirectory();
Clean filename
$cleanFilename = File::cleanFilename($dirtyFilename);
Download file to temporary directory
$file = File::download($fileUrl);
Csv file
use Phant\File\Csv; $file = new File('path/filename.csv');
Verify columns
$isConform = $file->verifyColumns($columns);
Get number of lines
$nbLines = $file->getNbLines();
Read file by line
foreach ($file->readFileByLine() as $line) { }
Zip file
use Phant\File\Zip; $file = new File('path/filename.zip');
Unarchive
$files = $file->unarchive(); foreach ($files as $file) { }