PHP code example of vube / php-filesystem

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

    

vube / php-filesystem example snippets


// Explicitly create a directory.
// ALL parent dirs we create will share mode 0775 as modified by your umask

$installer = new Vube\FileSystem\Installer();
$installer->installDir('/path/to/some/dir', 0775);

// Install files into /existing-dir
//
// When installing into subdirs, we create all dirs needed,
// the mode is set by your umask.
//
// File installs are network-safe, providing 100% uptime
// on production systems.

$installer = new Vube\FileSystem\Installer();

$installer->installFile('file1', '/existing-dir/file1');
$installer->installFile('file2', '/existing-dir/new-dirs-we-create/with/subdirs/file2');

// Create or overwrite /path/to/symlink
//
// If it already exists, it is atomically updated.

$installer = new Vube\FileSystem\Installer();
$installer->symlink('/path/to/actual', '/path/to/symlink');

// Compare file1 and file2; are they different?

$differ = new Vube\FileSystem\FileDiffer();

if($differ->isDiff('file1', 'file2'))
    echo "These files are different.\n";

// Gzip source.txt and save the result in destination.gz

$zipper = new Vube\FileSystem\Gzip();
$zipper->zip('source.txt', 'destination.gz');