PHP code example of nex-otaku / minimal-filesystem

1. Go to this page and download the library: Download nex-otaku/minimal-filesystem library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nex-otaku / minimal-filesystem example snippets


$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!');