phpunit/php-file-iterator
php-file-iterator provides a simple, dependency-free way to filter and iterate over files by suffix, prefix, or custom filters, powering PHPUnit's test file discovery. Install it via Composer to find and list files matching patterns in any PHP project.
phpunit/php-file-iterator is not a product dependency — it is a low-level utility that PHPUnit uses internally for test discovery (via phpunit/php-code-coverage). It arrives in vendor/ automatically when the team runs tests. The correct PM decision is to not add it explicitly to composer.json and to treat it as an implementation detail of the test toolchain.#84 dropped directories during wildcard resolution; 7.0.1/7.0.2 addressed hidden directories, Windows path separators, and prefix-collision exclusions). This is inherited risk from the test framework, not incremental risk from a new vendor.Consider it (implicitly) when:
** globstar) and filter by suffix/prefix/exclude, and you specifically want the same traversal semantics as the test runner so local runs and CI agree.addSuffix/addPrefix/addExclude returning new instances) rather than a fully featured filesystem abstraction.Look elsewhere when:
symfony/finder (already a Laravel dependency) — it is the ecosystem standard, handles symlinks/permissions/multi-condition filters, and has a stable public API.FilterIterator directly or build on Finder; chaining name filters will not get you there.To executives: This is a zero-cost, zero-procurement item. It is a BSD-3-Clause utility that already lives inside PHPUnit, which we already use — there is no new vendor, no license review, and no incremental spend. The only "decision" is to leave it alone. The one thing worth putting on the radar is that its version tracks PHP releases, so it will surface as a small gating item during our next PHP upgrade; that work is already implied by the PHPUnit upgrade we would be doing anyway.
To engineering: Do not add phpunit/php-file-iterator to composer.json directly — consume it transitively through PHPUnit and keep it development-only. For any file enumeration in application or tooling code we own, use Symfony Finder for consistency with the rest of the Laravel stack. If we ever build internal tooling that must mirror the test runner's glob/directory semantics, this gives us those semantics for free — but note the API is unstable by design (major bump per PHP minor) and the traversal logic has had edge-case fixes as recently as 7.0.2, so pin and test rather than assume.
How can I help you explore Laravel packages today?