mitsuru793 / file-constructor
Make file and directory from php array.
v0.0.1
2021-01-09 18:23 UTC
Requires
- php: ^7.4 || ^8.0
- illuminate/collections: ^8.18
- nesbot/carbon: ^2.43
- symfony/finder: ^5.2
- symfony/stopwatch: ^5.2
Requires (Dev)
- phpstan/phpstan: ^0.12.65
- phpunit/phpunit: ^9.5
- symfony/var-dumper: ^5.2
This package is auto-updated.
Last update: 2025-03-10 03:18:10 UTC
README
Make file and directory from php array.
Install
composer mitsuru793/file-constructor
Example
<?php $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.
Test
You can use factory method to use a temporary directory. This will make a root directory as temporary.
<?php $fs = FileConstructor::inTempDir(); $fs->append([ 'f1' => 'hello', ]);