mibadger / file
This package is abandoned and no longer maintained.
No replacement package was suggested.
The File Component
v4.0.0
2021-08-12 09:47 UTC
Requires
- php: ^7.2 || ^8.0
Requires (Dev)
- mikey179/vfsstream: ^1.6
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2022-11-19 17:10:28 UTC
README
The File Component.
Example
<?php use miBadger\File\File; /** * Constructs a File object with the given path. */ $file = new File($path); /** * Returns the path of the file. */ $file->getPath(); /** * Returns the parent directory of the file. */ $file->getDirectory(); /** * Returns the name of the file. */ $file->getName(); /** * Returns true if the file exists. */ $file->exists(); /** * Returns true if you can execute the file. */ $file->canExecute(); /** * Returns true if you can read the file. */ $file->canRead(); /** * Returns true if you can write the file. */ $file->canWrite(); /** * Returns true if the file is a file. */ $file->isFile(); /** * Returns true if the file is a directory. */ $file->isDirectory(); /** * Returns the numer of bytes in the file, or -1 on failure. */ $file->count(); /** * Returns the numer of bytes in the file, or -1 on failure. */ $file->length(); /** * Returns the time of the last modification as a unixtimestap, or -1 on failure. */ $file->lastModified(); /** * Returns an array with the files and directories in the current directory. */ $file->listAll($recursive = false, $showHidden = false); /** * Returns an array with the directories in the current directory. */ $file->listDirectories($recursive = false, $showHidden = false); /** * Returns an array with the files in the current directory. */ $file->listFiles($recursive = false, $showHidden = false); /** * Returns true if the file has been created. */ $file->makeFile($override = false); /** * Returns true if the directory has been created. */ $file->makeDirectory($recursive = false, $permissions = 0775); /** * Returns true if the file is succesfully moved. */ $file->move($path, $override = false); /** * Returns true if the file is succesfully renamed. */ $file->rename($file, $override = false); /** * Returns true if the directory is succesfully removed. */ $file->removeDirectory($recursive = false); /** * Returns true if the file is succesfully removed */ $file->removeFile(); /** * Returns the content of the file. */ $file->read(); /** * Append the given content. */ $file->append($content); /** * Write the given content. */ $file->write($content);