PHPackages                             toolkit/fsutil - 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. toolkit/fsutil

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

toolkit/fsutil
==============

some file system tool library of the php

v2.0.7(11mo ago)66.2k↑155.3%12MITPHPPHP &gt;=8.1.1CI passing

Since Jun 11Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/php-toolkit/fsutil)[ Packagist](https://packagist.org/packages/toolkit/fsutil)[ Docs](https://github.com/php-toolkit/fsutil)[ RSS](/packages/toolkit-fsutil/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (1)Versions (22)Used By (2)

FileSystem Util
===============

[](#filesystem-util)

[![License](https://camo.githubusercontent.com/830f1bfbb0727a399d956e142c57a5664f61d6b46e6784ff26ef1a3afcfaad66/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f6f6c6b69742f66737574696c2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Php Version Support](https://camo.githubusercontent.com/0671b983fc9ec0bda19c54efe3045da1a296b9725d82369645dfa6e9b7c27ba4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f6f6c6b69742f66737574696c)](https://packagist.org/packages/toolkit/fsutil)[![Latest Stable Version](https://camo.githubusercontent.com/9b812a8042a73374f306e63154a11c171b522a5f371a1bfdaf116f20cb70fbd2/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f6f6c6b69742f66737574696c2e737667)](https://packagist.org/packages/toolkit/fsutil)[![Actions Status](https://github.com/php-toolkit/fsutil/workflows/Unit-tests/badge.svg)](https://github.com/php-toolkit/fsutil/actions)

Some useful file system util for php.

- basic filesystem operation
- file read/write operation
- directory operation
- file modify watcher
- files finder
- file tree builder

Install
-------

[](#install)

- Required PHP 8.0+

```
composer require toolkit/fsutil
```

File Finder
-----------

[](#file-finder)

```
use Toolkit\FsUtil\Extra\FileFinder;

$finder = FileFinder::create()
    ->files()
    ->name('*.php')
    // ->ignoreVCS(false)
    // ->ignoreDotFiles(false)
    // ->exclude('tmp')
    ->notPath('tmp')
    ->inDir(dirname(__DIR__));

foreach ($finder as $file) {
    // var_dump($file);
    echo "+ {$file->getPathname()}\n";
}
```

File Tree Builder
-----------------

[](#file-tree-builder)

`FileTreeBuilder` - can be quickly create dirs and files, copy dir and files.

- can use path var in `dir()`, `copy()` ... methods. eg: `copy('{baseDir}/to/file', '{workdir}/dst/file')`

Quick start:

```
use Toolkit\FsUtil\Extra\FileTreeBuilder;

$ftb = FileTreeBuilder::new()
    ->setWorkdir($workDir)
    ->setShowMsg(true);

// copy dir to $workDir and with exclude match.
$ftb->copyDir('/path/to/dir', './', ['exclude'  => ['*.tpl']])
    ->copy('/tplDir/some.file', 'new-file.txt') // copy file to $workDir/new-file.txt
    // make new dir $workDir/new-dir
    ->dir('new-dir', function (FileTreeBuilder $ftb) {
        $ftb->file('sub-file.txt') // create file on $workDir/new-dir
            ->dirs('sub-dir1', 'sub-dir2'); // make dirs on $workDir/new-dir
    })
    ->file('new-file1.md', 'contents'); // create file on $workDir
```

Will create file tree like:

```
./
 |-- new-file.txt
 |-- new-dir/
     |-- sub-file.txt
     |-- sub-dir1/
     |-- sub-dir2/
 |-- new-file1.md

```

### path vars

[](#path-vars)

- `tplDir` The template dir path
- `baseDir` base workdir path, only init on first set workdir.
- `current,workdir` current workdir path.
- And all simple type var in `tplVars`.

Usage in path string: `{baseDir}/file`

Modify Watcher
--------------

[](#modify-watcher)

```
use Toolkit\FsUtil\Extra\ModifyWatcher;

$w  = new ModifyWatcher();
$ret = $w
    // ->setIdFile(__DIR__ . '/tmp/dir.id')
    ->watch(dirname(__DIR__))
    ->isChanged();

// d41d8cd98f00b204e9800998ecf8427e
// current file:  ae4464472e898ba0bba8dc7302b157c0
var_dump($ret, $mw->getDirMd5(), $mw->getFileCounter());
```

License
-------

[](#license)

MIT

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance66

Regular maintenance activity

Popularity28

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 93.5% of commits — single point of failure

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

Every ~88 days

Recently: every ~275 days

Total

21

Last Release

337d ago

Major Versions

v1.1.2 → v2.0.02021-11-30

PHP version history (4 changes)v1.0.0PHP &gt;7.1.0

v1.1.1PHP &gt;7.3.0

v2.0.0PHP &gt;=8.0.1

v2.0.7PHP &gt;=8.1.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/d23e1decaf354e8f36a7ad61128865dc78dd63336c2d023d79aa3ff8ba2a05ff?d=identicon)[inhere](/maintainers/inhere)

---

Top Contributors

[![inhere](https://avatars.githubusercontent.com/u/5302062?v=4)](https://github.com/inhere "inhere (72 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")

---

Tags

file-finderfile-treefilesystemphpfilesystemlibrarytool

### Embed Badge

![Health badge](/badges/toolkit-fsutil/health.svg)

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

###  Alternatives

[oneduo/nova-file-manager

A handy file manager tool for Laravel Nova

158329.9k2](/packages/oneduo-nova-file-manager)

PHPackages © 2026

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