Skip to content

Latest commit

 

History

History
114 lines (64 loc) · 1.11 KB

README.md

File metadata and controls

114 lines (64 loc) · 1.11 KB

Files

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) {
}