PHP Classes

PHP File Explorer: Find files that match a given criteria in a folder

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 91 All time: 9,935 This week: 488Up
Version License PHP version Categories
php-file-explorer 1.0The PHP License5PHP 5, Files and Folders, Searching
Description 

Author

This package can find files that match the given criteria in a folder.

It can scan a folder recursively to search for files that match a given file name extension.

It can also exclude specific files with names that match a regular expression

The package can return an array of files that match the criteria.

Picture of DeGraciaMathieu
  Performance   Level  
Name: DeGraciaMathieu <contact>
Classes: 21 packages by
Country: France France
Age: ???
All time rank: 289780 in France France
Week rank: 4 Up1 in France France Up
Innovation award
Innovation award
Nominee: 15x

Winner: 2x

Documentation

PHP Composer packagist) packagist)

php-file-explorer

Code extracted from bmitch/churn-php

Usage

$fileFinder = new FileFinder(
    fileExtensions: ['php'], 
    filesToIgnore: [], 
    basePath: __DIR__,
);

$files = $fileFinder->getFiles(paths: [
   __DIR__,
]);

foreach ($files as $file) {
   $file->getFullPath();
   $file->getDisplayPath();
}

Tests

make test
make coverage

  Files folder image Files (20)  
File Role Description
Files folder image.github (1 directory)
Files folder imagesrc (3 files)
Files folder imagetests (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file Makefile Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (20)  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files (20)  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file build.yml Data Auxiliary data

  Files folder image Files (20)  /  src  
File Role Description
  Plain text file File.php Class Class source
  Plain text file FileFinder.php Class Class source
  Plain text file FileHelper.php Class Class source

  Files folder image Files (20)  /  tests  
File Role Description
Files folder imageUnit (3 files, 2 directories)

  Files folder image Files (20)  /  tests  /  Unit  
File Role Description
Files folder imageAssets (4 files)
Files folder imageAssets2 (2 files, 1 directory)
  Plain text file FileFinderTest.php Class Class source
  Plain text file FileHelperTest.php Class Class source
  Plain text file FileTest.php Class Class source

  Files folder image Files (20)  /  tests  /  Unit  /  Assets  
File Role Description
  Plain text file Bar.php Class Class source
  Plain text file Baz.php Class Class source
  Plain text file Foo.php Class Class source
  Plain text file Qux.inc Class Class source

  Files folder image Files (20)  /  tests  /  Unit  /  Assets2  
File Role Description
Files folder imageDeepAssets (3 files)
  Plain text file Foo2.php Class Class source
  Plain text file Qux2.inc Class Class source

  Files folder image Files (20)  /  tests  /  Unit  /  Assets2  /  DeepAssets  
File Role Description
  Plain text file Deep.php Class Class source
  Plain text file Deep2.php Class Class source
  Plain text file Different.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:91
This week:0
All time:9,935
This week:488Up