Minimal Filesystem
Zero dependency. Small and powerful.
Installation
The preferred way to install is through composer.
composer require nex-otaku/minimal-filesystem
Packagist allows installation of new packages, including this one, to only Composer version 2. (see how to upgrade)
So if you are tied to Composer version 1, you can't install package with the command above.
If it is your case, you can just copy-paste source file to your project. It has no dependencies and should work just fine.
Examples
$fs = new \NexOtaku\MinimalFilesystem\Filesystem();
// List all files in directory
var_dump($fs->listFiles('/var/www'));
// Search all TXT files in directory
var_dump($fs->searchFiles('/var/www', '*.txt'));
// Read file
echo $fs->readFile('/var/log/my-app.log');
// Write file
$fs->writeFile('/var/etc/my-app.conf', json_encode(['favoriteCoffee' => 'Double Espresso']));
// Append to file
$fs->appendToFile('/var/log/my-app.log', 'Logging is easy!');
Filesystem commands
Directories
- createDirectory
- getCurrentDirectory
- existsDirectory
- isDirectory
Files
- writeFile
- appendToFile
- isReadableFile
- readFile
- renameFile
- deleteFile
- existsFile
- isFile
Paths
- exists
Listing, searching:
- listFiles
- searchFiles
- searchFilesRecursively
Questions? Ask!
Telegram: @nex_otaku
Email: nex-otaku@yandex.ru
License
- MIT license
- Copyright 2021 © Nex Otaku.