PHP code example of elementaryframework / fire-fs

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

    

elementaryframework / fire-fs example snippets




use ElementaryFramework\FireFS\FireFS;

// Create a new file system instance at the given path
$fs = new FireFS("./app"); // /root/var/www/htdocs/app/

// Check if the path "/root/var/www/htdocs/app/images/" exists
if ($fs->exists("images")) {
    // Change the working directory to the images folder
    $fs->setWorkingDirectory("./images");

    // Create a new file in the working directory
    $fs->mkfile("./logo.png"); // /root/var/www/htdocs/app/images/logo.png

    // Read file from the file system root path
    $logo = $fs->read("logo.png"); // /root/var/www/htdocs/app/logo.png

    // Write into the created file
    $fs->write("./logo.png", $logo); // /root/var/www/htdocs/app/images/logo.png

    // Delete the old file
    $fs->delete("logo.png"); // /root/var/www/htdocs/app/logo.png
}

// Change the working directory to the file system root path
$fs->setWorkingDirectory("./");

// Create a "blog" directory
$fs->mkdir("blog"); // /root/var/www/htdocs/app/blog/

// Move "images" folder from "app" to "app/blog"
$fs->move("images", "blog/images");

// And more !