amircandy/litefs
Composer 安装命令:
composer require amircandy/litefs
包简介
LiteFS is a lightweight, fast, and easy-to-use PHP file system manager library.
README 文档
README
LiteFS - Lightweight PHP File Manager Library
LiteFS is a modern, fast, and easy-to-use PHP library for managing files and directories. It provides a clean API for common file management tasks such as creating directories, copying files, moving files, deleting files, and more.
Features
- Create directories and files
- Copy directories and files
- Move or rename files and directories
- Delete files and directories
- List files and directories
- Check if files or directories exist
- Handle file paths relative to a given root path
- Supports recursive directory iteration
Installation
You can install LiteFS by cloning the repository or by downloading the source code directly. ( Composer is avalible , install by : composer require amircandy/litefs)
Clone the repository
git clone https://github.com/AmiRCandy/LiteFS.git
cd LiteFS
Manual Download
Download the ZIP file from GitHub and extract it.
Usage
1. Create a FileManager Instance
use LiteFS\LiteFS; $fileManager = new LiteFS('/path/to/base/directory');
The constructor accepts the path to the base directory where the operations will be performed.
2. Create a Directory
$fileManager->createDir('my/new/directory');
Creates a new directory relative to the base directory.
3. Copy a Directory
$fileManager->copyDir('source/directory', 'destination/directory');
Copies the entire directory, including subdirectories and files.
4. Move a File or Directory
$fileManager->move('source/file', 'destination/file');
Moves or renames a file or directory.
5. Delete a File or Directory
$fileManager->delete('file/to/delete');
Deletes the specified file or directory. If it's a directory, it deletes all files inside it recursively.
6. Check if a File or Directory Exists
if ($fileManager->exists('file/to/check')) { echo 'File or directory exists.'; }
Returns true if the file or directory exists, otherwise false.
7. List Files in a Directory
$files = $fileManager->listFiles('directory/to/list'); print_r($files);
Lists all files inside the specified directory. It returns an array of file names.
8. Get File Size
$size = $fileManager->getFileSize('file/to/size'); echo 'File size: ' . $size . ' bytes';
Returns the size of the file in bytes.
9. Delete Multiple Files
$fileManager->deleteMultiple(['file1.txt', 'file2.txt']);
Deletes multiple files in one call.
API Reference
LiteFS Methods
__construct(string $basePath): Initializes theLiteFSwith the specified base directory.createDir(string $path): Creates a new directory.copyDir(string $src, string $dest): Copies a directory fromsrctodest.move(string $src, string $dest): Moves or renames a file or directory.delete(string $path): Deletes a file or directory.deleteMultiple(array $files): Deletes multiple files.exists(string $path): Checks if a file or directory exists.listFiles(string $path): Lists files in a directory.getFileSize(string $path): Gets the size of a file.
To-Do List for LiteFS Development
Features to Add
- Add support for file permissions (read/write/execute).
- Add file search functionality within directories.
- Create a logging mechanism for all file operations performed by the library.
- Add support for symbolic links.
- Add file compression (zip/gzip) and decompression support.
- Support for file timestamps (last modified, creation date).
- Support for file ownership.
Contributing
If you'd like to contribute to LiteFS, please fork the repository and submit a pull request. Contributions are welcome!
License
This project is licensed under the MIT License - see the LICENSE file for details.
amircandy/litefs 适用场景与选型建议
amircandy/litefs 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 04 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「file」 「filesystem」 「directory」 「lite」 「file-manager」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 amircandy/litefs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 amircandy/litefs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 amircandy/litefs 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A SDK for working with B2 cloud storage.
A PHP class providing static methods for reading, writing, copying, moving, and deleting files and directories, MIME type detection, image size detection, and file permission management
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
The flysystem adapter for yandex disk rest api.
A sleek PHP wrapper around rclone with Laravel-style fluent API syntax
Laravel Media Popup to upload/view the files
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-22