nex-otaku/minimal-filesystem

Minimal Filesystem

2.0.0 2021-06-11 16:45 UTC

This package is auto-updated.

Last update: 2024-10-26 13:34:31 UTC


README

Minimal Filesystem

Zero dependency. Small and powerful.

Installation

The preferred way to install is through composer.

composer require nex-otaku/minimal-filesystem

Alternatively, 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

License