thapp/fileitr

Bunch of fileiterators

Maintainers

Details

github.com/iwyg/fileitr

Source

Issues

Installs: 11

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 0

Open Issues: 0

Type:package

v0.1.1 2016-04-12 18:03 UTC

This package is not auto-updated.

Last update: 2024-12-19 02:00:17 UTC


README

Author Source Code Software License

Build Status Code Coverage HHVM

Requirements

php >= 5.6

Installation

> composer require thapp/fileitr

Usage

PatternIterator

PatternIterator is used to recursively iterate over directories and files using a regular expression as filter.

<?php
use Thapp\Fileitr\PatternIterator;

// iterates over a maximum directory depth of 2, searching for files with a '.php' suffix
$itr = new PatternIterator($path, '/\.(php)$/', 2, -1, $flags);

// iterates over a maximum directory depth of 1, and limits overall files to 3.
$itr = new PatternIterator($path, '/\.(php)$/', 1, 3, $flags);

RecursiveDirectoryIterator

The RecursiveDirectoryIterator extends \RecursiveDirectoryIterator.

Key differences:

  • ability to limit overall file count.
  • will ouput a custom FileInfo Object including relative path, and relative pathname
  • only accepts CURRENT_AS_FILEINFO, not CURRENT_AS_SELF nor CURRENT_AS_PATHNAME