PHP code example of amircandy / litefs

1. Go to this page and download the library: Download amircandy/litefs 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/ */

    

amircandy / litefs example snippets


use LiteFS\LiteFS;

$fileManager = new LiteFS('/path/to/base/directory');

$fileManager->createDir('my/new/directory');

$fileManager->copyDir('source/directory', 'destination/directory');

$fileManager->move('source/file', 'destination/file');

$fileManager->delete('file/to/delete');

if ($fileManager->exists('file/to/check')) {
    echo 'File or directory exists.';
}

$files = $fileManager->listFiles('directory/to/list');
print_r($files);

$size = $fileManager->getFileSize('file/to/size');
echo 'File size: ' . $size . ' bytes';

$fileManager->deleteMultiple(['file1.txt', 'file2.txt']);