phpfit / file
A simple library to work with local files
1.0.0
2025-08-14 07:15 UTC
README
A simple library to work with local files.
Installation
composer require phpfit/file
Usage
<?php use PhpFit\File\FileSystem; $dir = '/home/apps/site.com/folder/to/clean/up'; FileSystem::cleanUp($dir);
Classes
PhpFit\File\FileSystem
static cleanUp(string $path): bool
Remove all folders from $path
up until the parent is not empty.
static copy(string $source, string $target): bool
Copy a file from one location to anthoer, if target folder is not exists, the folder will be created.
static mkdir(string $path): bool
Create directory recursively if it's not exists. This action will set folder
permission to 0777
.
static rmdir(string $path): bool
Remove dir with all of it's files.
static scan(string $path): array
Scan directory and return list of files in the directory.
static write(string $path, string $text, string $mode = 'w'): bool
Write some text to a file. The mode
parameter accept a
for appending the text
or w
to overwrite the file.
License
The phpfit/env library is licensed under the MIT license. See License File for more information.