PHP code example of mitsuru793 / file-constructor
1. Go to this page and download the library: Download mitsuru793/file-constructor 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/ */
mitsuru793 / file-constructor example snippets
$root = '/tmp/test';
$fs = new FileConstructor($root);
$fs->append([
'dir1' => [],
'dir2' => [
'dir3' => [],
'dir2-f1' => '',
],
'f1' => '',
'f2' => 'hello',
]);
// has made dirs and files
// If value is string, it's file content.
$fs = FileConstructor::inTempDir();
$fs->append([
'f1' => 'hello',
]);