Very basic tools to help you get around the filesystem with PHP.
This package is under active development.
If you have any problems, suggestions or wishes, feel free to create an issue to let me know!
composer require likeajohny/php-fs
- Directory
- create
- exists
- remove
- empty
- move
- copy
- list
- File
- create
- exists
- write
- append
- prepend
- read
- remove
- copy
- move
- The directory to create the file in has to exist.
PhpFs\File::create('./filepath/cool-story-bro.txt');
- Writes contents to a given file
- Overrides pre-existing content in the file
PhpFs\File::write('./filepath/cool-story-bro.txt', 'Let me tell you a story!');
- Appends content to a given file
PhpFs\File::append('./filepath/cool-story-bro.txt', "\nAnd the story goes as follows:");
- Prepends content to a given file
PhpFs\File::prepend('./filepath/cool-story-bro.txt', "The stories foreword\n");
- always recursive
PhpFs\Directory::remove('./path/to/directory');
- always recursive
PhpFs\Directory::empty('./path/to/directory');