whatisgithub

What is php-file-iterator?

sebastianbergmann/php-file-iterator — explained in plain English

Analysis updated 2026-06-24

7,491PHPAudience · developerComplexity · 2/5Setup · easy

In one sentence

Small PHP library that scans directories and filters files by extension or prefix, mainly used as a dependency inside PHPUnit and other PHP testing tools.

Mindmap

mindmap
  root((php-file-iterator))
    What it does
      Scan directories
      Filter by extension
      Exclude by prefix
    Use cases
      PHPUnit helper
      Build tools
      Static analysis
    Setup
      Composer install
      Single command
    Audience
      PHP developers
      Test tool authors
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Scan a project directory and collect only .php files for processing in a build or code analysis tool.

USE CASE 2

Filter out test fixture files starting with specific prefixes when assembling a PHPUnit test suite.

USE CASE 3

Use as a dependency in a custom PHP testing or static analysis tool that needs recursive directory scanning.

What is it built with?

PHPComposer

How does it compare?

sebastianbergmann/php-file-iteratorphar-io/manifestlcobucci/jwt
Stars7,4917,4877,479
LanguagePHPPHPPHP
Setup difficultyeasyeasyeasy
Complexity2/52/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min
No license information found in this repository's README.

So what is it?

This is a small PHP library that helps developers scan directories and filter files based on rules you define. You can tell it to only include files with certain endings (like ".php" or ".txt"), exclude files that start with specific prefixes, or skip files that match other criteria you set up. It is mainly used as a helper inside testing tools, including PHPUnit, which is a widely used PHP testing framework. Most PHP developers encounter this library indirectly when running automated tests rather than using it directly in application code. Installation is handled through Composer, the standard PHP package manager. You add it to your project with a single command. The README is short and covers only installation basics, so the full feature set is documented elsewhere in the package itself.

Copy-paste prompts

Prompt 1
Using php-file-iterator, write PHP code that scans my src/ directory recursively and returns only .php files while excluding any file starting with Abstract or Mock.
Prompt 2
How do I integrate php-file-iterator into a custom PHPUnit test runner that needs to collect files from multiple directories with different file suffixes?
Prompt 3
Write a PHP script using php-file-iterator that finds all .twig template files in a templates/ folder and lists their paths.

Frequently asked questions

What is php-file-iterator?

Small PHP library that scans directories and filters files by extension or prefix, mainly used as a dependency inside PHPUnit and other PHP testing tools.

What language is php-file-iterator written in?

Mainly PHP. The stack also includes PHP, Composer.

What license does php-file-iterator use?

No license information found in this repository's README.

How hard is php-file-iterator to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is php-file-iterator for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.