PHPackages                             crysalead/dir - 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. crysalead/dir

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

crysalead/dir
=============

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

2.0.4(4y ago)13214.5k↓18.8%54MITPHPPHP &gt;=5.4

Since Mar 19Pushed 4y ago4 watchersCompare

[ Source](https://github.com/crysalead/dir)[ Packagist](https://packagist.org/packages/crysalead/dir)[ RSS](/packages/crysalead-dir/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (8)Used By (4)

Dir - Directory Scanner
=======================

[](#dir---directory-scanner)

[![Build Status](https://camo.githubusercontent.com/c801003ff1d6cffdf9a47e7e4ba4267630e84a2f1ec43039ab768018fd1efce4/68747470733a2f2f7472617669732d63692e6f72672f63727973616c6561642f6469722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/crysalead/dir)[![Code Coverage](https://camo.githubusercontent.com/b49013d978d7d638c6471c5a4f69a533e62192c60b0e35fee003b9fc551eaae6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63727973616c6561642f6469722f6261646765732f636f7665726167652e706e673f733d65663666303764656163636163353664306634633135393166633939373631666564383534343631)](https://scrutinizer-ci.com/g/crysalead/dir/)

Dir is a small library which allows to perform some recursive operations on directories.

`Dir::scan()`
-------------

[](#dirscan)

Gets all nested directories and/or files present inside a directory.

```
$files = Dir::scan('my/dir',       // Can be a string path of an array of string paths
    [
        'include' => '*.txt',      // Can be an array of includes
        'exclude' => '*.save.txt', // Can be an array of excludes
        'type'    => 'file'        // Can be an array of types, possible values:
                                   // `'file'`, `'dir'`, `'executable'`, `'link'`, `'readable'`, `'writable'`
        'skipDots'       => true,  // Keeps '.' and '..' directories in result
        'leavesOnly'     => true,  // Keeps only leaves
        'followSymlinks' => true,  // Follows Symlinks
        'recursive'      => true   // Scans recursively,
        'copyHandler'    => function($path, $target) { // The copy handler
            copy($path, $target);
        }
    ]
);
```

`Dir::copy()`
-------------

[](#dircopy)

Copies a directory with files recursively into a destination folder.

```
$files = Dir::copy('my/dir',       // A string path of an array of string paths
    'my/destination',              // A destination path (string only)
    [
        'mode'           => 0755,  // Mode used for directory creation
        'childrenOnly'   => false, // Copies the file inside 'my/dir' if `true`, otherwise `dir` will be
                                   // added as the root directory.
        'followSymlinks' => true,  // Follows Symlinks
        'recursive'      => true   // Scans recursively
    ]
);
```

`Dir::remove()`
---------------

[](#dirremove)

Removes a directory and all its content recursively.

```
Dir::remove('my/dir',     // Can be a string path of an array of string paths
    [
        'followSymlinks' => false,        // Follows Symlinks
        'recursive'      => true,         // Scans recursively
        'include'        => '*.txt',      // Can be an array of includes
        'exclude'        => '*.save.txt', // Can be an array of excludes
    ]
);
```

`Dir::make()`
-------------

[](#dirmake)

Makes nested directories.

```
$success = Dir::make('my/dir',  // Can be a string path of an array of string paths
    [
        'mode'      => 0755,         // Mode used for directory creation
        'recursive' => true,         // Scans recursively
        'include'   => '*.txt',      // Can be an array of includes
        'exclude'   => '*.save.txt', // Can be an array of excludes
    ]
);
```

`Dir::tempnam()`
----------------

[](#dirtempnam)

Creates a temporary folder (like the `tempnam()` function but for directories).

```
$dir = Dir::tempnam(sys_get_temp_dir(), 'mytmp');
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~436 days

Recently: every ~588 days

Total

7

Last Release

1462d ago

Major Versions

1.0.1 → 2.0.02015-12-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/67c78f317fdfb9f077b1f16c88193192f7562e999c536b25943b759c3b5099fb?d=identicon)[jails](/maintainers/jails)

---

Top Contributors

[![jails](https://avatars.githubusercontent.com/u/1306941?v=4)](https://github.com/jails "jails (28 commits)")

---

Tags

filedirectoryfile systemDirectory Scanner

### Embed Badge

![Health badge](/badges/crysalead-dir/health.svg)

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

###  Alternatives

[adlawson/vfs

Virtual file system

300433.0k21](/packages/adlawson-vfs)[icecave/temptation

Painless temporary files and directories that clean up after themselves.

129.3k2](/packages/icecave-temptation)

PHPackages © 2026

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