PHPackages                             acadea/dir-iterator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. acadea/dir-iterator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

acadea/dir-iterator
===================

A simple PHP library to recursively find all files in a directory.

v1.0.1(4y ago)2116MITPHPPHP ^7.4

Since Jun 17Pushed 4y ago1 watchersCompare

[ Source](https://github.com/acadea/php-dir-iterator)[ Packagist](https://packagist.org/packages/acadea/dir-iterator)[ Docs](https://github.com/acadea/php-dir-iterator)[ GitHub Sponsors](https://github.com/acadea)[ RSS](/packages/acadea-dir-iterator/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (6)Versions (3)Used By (0)

A simple PHP library to recursively find all files in a directory.
==================================================================

[](#a-simple-php-library-to-recursively-find-all-files-in-a-directory)

[![Latest Version on Packagist](https://camo.githubusercontent.com/bf35493259c2f9393468a20a596391fdf08a7467aecbb01639641882082e9400/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6163616465612f6469722d6974657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/acadea/dir-iterator)[![GitHub Tests Action Status](https://camo.githubusercontent.com/b222deb71bf6f386b47ebb811f89fb78b1f5e18586f1b8cd79ba83f94dab57b6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6163616465612f6469722d6974657261746f722f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/acadea/dir-iterator/actions?query=workflow%3ATests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/756fbbf64f049a100dc8d92817fa61e07736c9d37935fb9259f97bcd03ea7779/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6163616465612f6469722d6974657261746f722f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/acadea/dir-iterator/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/7f6a4948dc983c7d2bff0542b3cea62b7f3af334ec4e6a705908a389a91e4fb7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6163616465612f6469722d6974657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/acadea/dir-iterator)

A lightweight PHP package to recursively iterate through a folder with ease. Based on [Symfony's Finder](https://symfony.com/doc/current/components/finder.html) and PHP's [Recursive Iterator](https://www.php.net/manual/en/class.recursiveiteratoriterator.php)

Support us
----------

[](#support-us)

We invest a lot of resources into creating open source packages. You can support us by subscribing to our [Youtube channel](https://www.youtube.com/channel/UCU5RsUGkVcPM9QvFHyKm1OQ) (we have a lot of tutorials on web development!) or by [joining our Learning Portal](https://acadea.io/learn).

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require acadea/dir-iterator
```

Usage
-----

[](#usage)

```
// get all the files in a folder
// $file is an array of SplFileInfo object
$files = \Acadea\DirIterator\DirIterator::getFiles('path/to/folder');

// recursively iterate through a folder
\Acadea\DirIterator\DirIterator::iterate('path/to/folder', function (SplFileInfo $fileInfo, string $filePath){
    // ....
});

// map all the files in a folder
$results = \Acadea\DirIterator\DirIterator::map('path/to/folder', function (SplFileInfo $fileInfo, string $filePath){
    // ...
    return 'something';
});

print_r($results); // $results should be an array of 'something'
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [sam-ngu](https://github.com/sam-ngu)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 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 ~0 days

Total

2

Last Release

1796d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/56226102?v=4)[Acadea](/maintainers/Acadea)[@acadea](https://github.com/acadea)

---

Top Contributors

[![sam-ngu](https://avatars.githubusercontent.com/u/30950704?v=4)](https://github.com/sam-ngu "sam-ngu (13 commits)")

---

Tags

acadeaphp directory iteratorrecursive directory iterator

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[wnx/laravel-stats

Get insights about your Laravel Project

1.8k1.8M7](/packages/wnx-laravel-stats)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[coenjacobs/mozart

Composes all dependencies as a package inside a WordPress plugin

4723.6M20](/packages/coenjacobs-mozart)[illuminate/session

The Illuminate Session package.

9937.4M753](/packages/illuminate-session)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[laragear/preload

Effortlessly make a Preload script for your Laravel application.

119363.5k](/packages/laragear-preload)

PHPackages © 2026

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