struam/dir-rotation
Composer 安装命令:
composer require struam/dir-rotation
包简介
PHP library for directory rotation
README 文档
README
DirRotation — is a library for managing directories and files in PHP.
It provides methods for creating, deleting, archiving, and changing the working directory.
Installation
To install the library, use Composer:
composer require struam/dir-rotation
Usage
Example of usage
require 'vendor/autoload.php'; use Struam\DirRotation\DirRotation; try { // Initialization without specifying the working directory $dirRotation = new DirRotation(); echo "Working Directory: " . $dirRotation->getWorkingDirectory(); // Creating a subdirectory $subdirectoryPath = $dirRotation->createSubdirectory('dir/new/temp'); echo "Subdirectory created at: " . $subdirectoryPath; // Archiving a subdirectory followed by deletion $archivePath = $dirRotation->archiveDirectory('dir/new/temp', true); echo "Directory archived at: " . $archivePath; // Changing the working directory $dirRotation->changeWorkingDirectory('/new/working/directory'); echo "Working Directory changed to: " . $dirRotation->getWorkingDirectory(); } catch (\Exception $e) { echo "Error: " . $e->getMessage(); }
Methods
__construct(string $workingDirectory = null)
Initializes the DirRotation object with the specified working directory. If the working directory is not specified, the current working directory is used.
- $workingDirectory (string|null)
Example:
'../', '../dir', '/var/project/dir', 'dir'
getWorkingDirectory()
Returns the current working directory.
changeWorkingDirectory(string $workingDirectory)
Changes the current working directory to the specified one.
- $workingDirectory (string)
Example:
'../', '../dir', '/var/project/dir', 'dir'
createSubdirectory(string $path)
Creates a subdirectory in the working directory.
- $path (string)
Example:
'dir', '/dir/new-dir', '/dir/new-dir/some-dir'
deleteSubdirectory(string $path)
Deletes a subdirectory from the working directory.
- $path (string)
Example:
'dir', '/dir/new-dir', '/dir/new-dir/some-dir'
archiveDirectory(string $path,bool $deleteAfterArchive = false)
Archives the specified directory and saves the archive in the parent directory.
Example:
Archive directory: '/dir/new-dir'
Current working directory: '/var/project/'
The archive will be saved in the directory: '/var/project/dir/new-dir.zip'
- $path (string)
The path to the directory to be archived.
Example:
'dir', '/dir/new-dir', '/dir/new-dir/some-dir'
- $deleteAfterArchive (bool)
If true, the directory will be deleted after archiving. Default is false.
License
This library is distributed under the MIT License. See the LICENSE file for details.
Contributing
Contributions and suggestions for improving the library are welcome. Please create an issue or pull request.
Author
Rustam Kadirov struam@gmail.com
Version History
1.0.0 First release
This README.md file provides essential information about the library, including installation, usage,
testing, and licensing. You can adapt it to your needs by adding additional sections or modifying existing ones.
struam/dir-rotation 适用场景与选型建议
struam/dir-rotation 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 01 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「dir」 「rotation」 「php83」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 struam/dir-rotation 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 struam/dir-rotation 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 struam/dir-rotation 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Library for Google Analytics 4 with Server Side Tagging
Php library for amazon echo (alexa) skill development.
This package contains php classes to access, change, copy, delete, move, rename files and directories.
A collection of file and directory management functions.
Fast and flexible PHP library for text tables.
AssetConnect is a file management library for CodeIgniter 4 that allows you to associate files with any entity in your application
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 32
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2025-01-17