Skip to content

PhantPHP/file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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