grinderspro/directory-manipulator
最新稳定版本:1.0.31
Composer 安装命令:
composer require grinderspro/directory-manipulator
包简介
Simple folder manipulation. Create, delete, rename folder
关键字:
README 文档
README
This package allows you to simply work with directories. Create, delete, rename and empty directories.
Installation
You can install the package via composer:
composer require grinderspro/directory-manipulator
Usage
Simple create a directory
To create a directory, use the create() method. If you use the create() method without parameters, then the directory will be created in the temporary system folder by default.
require __DIR__ . '/vendor/autoload.php'; use Grinderspro\DirectoryManipulator\DirectoryManipulator; (new DirectoryManipulator())->create();
Create many directories
$dm = (new DirectoryManipulator())->location('/var/tmp/')->clear(); for ($i=1; $i<=10; ++$i) { $dm->name('gm'.$i)->create(); }
Create directory - "/var/tmp/{time()}"
(new DirectoryManipulator())->location('/var/tmp/')->name()->create();
Create directory - "/var/tmp/grinderspro"
(new DirectoryManipulator())->location('/var/tmp/')->name('grinderspro')->create();
(new DirectoryManipulator())->location('/var/tmp/grinderspro')->create();
if((new DirectoryManipulator())->location('/var/tmp/grinderspro')->create()) return true;
To get the full path of the newly created directory, use the path() method without parameters.
$dirName = (new DirectoryManipulator())->create('/var/tmp/')->name()->path();
Delete directories
(new DirectoryManipulator())->location('/var/tmp/')->name('grinderspro')->delete();
(new DirectoryManipulator())->location('/var/tmp/grinderspro')->delete();
Clear directory
(new DirectoryManipulator())->location('/var/tmp/grinderspro')->clear();
统计信息
- 总下载量: 477
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-03-11