PHPackages                             liumapp/directory - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. liumapp/directory

ActiveLibrary[File &amp; Storage](/categories/file-storage)

liumapp/directory
=================

目录及文件操作工具

v1.0.0(9y ago)08MITPHPPHP &gt;=5.1

Since Mar 30Pushed 9y agoCompare

[ Source](https://github.com/liumapp/directory)[ Packagist](https://packagist.org/packages/liumapp/directory)[ Docs](http://git.huluwa.cc/liumei/huluwa-directory)[ RSS](/packages/liumapp-directory/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

directory
=========

[](#directory)

> php下对于目录及目录下文件操作的工具

使用方法
----

[](#使用方法)

### 目录及文件的创建

[](#目录及文件的创建)

```
 $lmD = new Directory();
 $lmD->setBasePath('/usr/local/var/www/');
 $lmD->buildPath('img/a' , 0755);
 $lmD->buildPath('img/b' , 0755);
 $lmD->buildPath('img/c' , 0755);
 $lmD->buildFile('img/a/a.txt' , 0755);
 $lmD->buildFile('img/b/b.txt' , 0755);
 $lmD->buildFile('img/c/c.txt' , 0755);
 $lmD->removeDirs('img/' , ['a']);//img目录下除了a以外其他全部删除掉

```

> 上述代码执行后会产生一个/usr/local/var/www/img/a/a.txt文件，b.txt和c.txt存在过，但之后被删除了。

### 文件的打开与写入

[](#文件的打开与写入)

```
$time = time();
$date = date('YmdH' , $time);
$fileName = 'tmp' . $time  . rand(100 , 999). '.html';
$directory =  new Directory();
$directory->file = new File();
$directory->setBasePath(Yii::getAlias('@vendor') . '/liumapp/dompdf/www/data');
$directory->buildPath($date);
$directory->buildFile($date . '/' . $fileName);
$directory->file->setFileName($directory->getAbsolutPath($date . '/' . $fileName));

$string = 'this is the one must be done';
$directory->file->open()->write($string);

```

> 上述代码执行后会产生一个/usr/local/var/www/vendor/liumapp/dompdf/www/data/2017091402/tmp1491356100.html的文件，文件内容是'this is the one you must be done'.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3380d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/21333655?v=4)[我敬你是条汉子](/maintainers/liumapp)[@liumapp](https://github.com/liumapp)

---

Tags

filedirectory

### Embed Badge

![Health badge](/badges/liumapp-directory/health.svg)

```
[![Health](https://phpackages.com/badges/liumapp-directory/health.svg)](https://phpackages.com/packages/liumapp-directory)
```

###  Alternatives

[adlawson/vfs

Virtual file system

299438.9k22](/packages/adlawson-vfs)[crysalead/dir

Recursive directory scanner to locate directories and/or files in a file system

13219.1k4](/packages/crysalead-dir)[icecave/temptation

Painless temporary files and directories that clean up after themselves.

109.4k2](/packages/icecave-temptation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
