sun/filesystem

This package helps you to manage your file easily.

v1.3 2015-08-04 10:10 UTC

This package is auto-updated.

Last update: 2024-12-08 18:04:58 UTC


README

Build Status Total Downloads Latest Stable Version Latest Unstable Version License

Filesystem helps you to manage your file easily.

Installation Process

Just copy Filesystem folder somewhere into your project directory. Then include filesystem autoloader.

 require_once('/path/to/Filesystem/autoload.php');

Filesystem is also available via Composer/Packagist.

 composer require sun/filesystem

All Methods

To create file
$filesystem = new Sun\Filesystem;
$filesystem->create(__DIR__.'/filename.txt', 'content');
To delete file
$filesystem->delete(__DIR__.'/filename.txt');
To update file
$filesystem->update(__DIR__.'/filename.txt', ' more content');
To get file content
$filesystem->get(__DIR__.'/filename.txt');
To append file content
$filesystem->append(__DIR__.'/filename.txt', 'more content');
To copy a file
$filesystem->copy(__DIR__.'/filename.txt', __DIR__.'/filename2.txt' );
To move a file
$filesystem->move(__DIR__.'/filename.txt', __DIR__.'/destination/filename.txt' );
To get filesize
$filesystem->size(__DIR__.'/filename.txt');
To check file exists
$filesystem->exists(__DIR__.'/filename.txt');
To get all files in a directory
$filesystem->files(__DIR__.'/directoryName');
To get all directories in a directory
$filesystem->directories(__DIR__.'/directoryName');
To create a directory
$filesystem->createDirectory(__DIR__.'/directoryName');
To delete a directory
$filesystem->deleteDirectory(__DIR__.'/directoryName');
To clean a directory
$filesystem->cleanDirectory(__DIR__.'/directoryName');

License

This package is licensed under the MIT License