unreal4u/file-operations
最新稳定版本:v0.4.3
Composer 安装命令:
composer require unreal4u/file-operations
包简介
This class is a collection of functions that deals with files
README 文档
README
unreal4u/file-operations
This class is able to retrieve files based on several parameters and perform configurable and extendable operations on them.
Credits
This class is made by unreal4u (Camilo Sperberg). unreal4u.com/
About this class
- This class will allow you to select files and perform operations on them.
- A few examples are included, such as get the contents or delete them
- Endless posibilities: just create your own and extend the abstract fileSelection class
- Needs PHP7+
Disclaimer
Usage of this class is entirely up to you. Read all documentation before you use this class!
Detailed description
This package is a collection of functions related to file manipulation. The idea behind it is actually pretty simple: with the base class fileSelection you select files, based on several parameters, such as maximum age of the file, or based on a regex selector.
After you have made your selection, you proceed to do the action. That action are actually classes that extend the base class and implement the final action which can be whatever you want. Included are 2 examples: a fileDeleter; which as the name states, is able to delete files (it also has a test mode, I suggest you use that before you put any code on production); and a contentGetter, which reads the file out and puts together an array with data.
Basic usage
<?php include 'vendor/autoload.php'; // Instantiate a deleter in test mode $fileDeleter = new unreal4u\FileOperations\fileDeleter(true); $options = [ 'pattern' => '/test\d{3}\.txt/', ]; $fileDeleter->constructFileList('testdir/', $options)->perform();
- Congratulations! All files that comply with the requirements would have been deleted!
- Please see examples and PHPUnit tests for more options and advanced usage
Composer
This class has support for Composer install and is the prefered method. Just add the following section to your composer.json with:
{
"require": {
"unreal4u/file-operations": "@stable"
}
}
Pending
- Change arguments in fileSelection to an array, with (optional) function callbacks
- Better documentation
- A first stable release
Version History
This package will be compatible with Semver once it reaches v1.0.0.
- 0.4.0:
- PHP7+ compatibility
- 0.2.0:
- BC breakage: function names changed
- Common interface
- 0.1.3:
- Complete code coverage
- 0.1.2:
- Array can be passed on with options
- First PHPUnit tests
- 0.1.1:
- More documentation
- More examples
- Minor improvements: assume a default of 0 seconds of maximum file age
- 0.1.0:
- Created basic class
Contact the author
- Twitter: @unreal4u
- Github: https://www.github.com/unreal4u
unreal4u/file-operations 适用场景与选型建议
unreal4u/file-operations 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 35 次下载、GitHub Stars 达 0, 最近一次更新时间为 2014 年 11 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 unreal4u/file-operations 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 unreal4u/file-operations 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 35
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-11-03