Skip to content

Tools to help you get around the filesystem with PHP.

Notifications You must be signed in to change notification settings

LikeAJohny/php-fs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP FS (Filesystem Helpers)

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!

Install

composer require likeajohny/php-fs

Functions

  • Directory
    • create
    • exists
    • remove
    • empty
    • move
    • copy
    • list
  • File
    • create
    • exists
    • write
    • append
    • prepend
    • read
    • remove
    • copy
    • move

File Usage Examples

Create A New File

  • The directory to create the file in has to exist.
PhpFs\File::create('./filepath/cool-story-bro.txt');

Write Content To A File

  • 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!');

Append To A File

  • Appends content to a given file
PhpFs\File::append('./filepath/cool-story-bro.txt', "\nAnd the story goes as follows:");

Prepend To A File

  • Prepends content to a given file
PhpFs\File::prepend('./filepath/cool-story-bro.txt', "The stories foreword\n");

Directory Usage Examples

Remove A Directory

  • always recursive
PhpFs\Directory::remove('./path/to/directory');

Empty A Directory

  • always recursive
PhpFs\Directory::empty('./path/to/directory');

About

Tools to help you get around the filesystem with PHP.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages