Search by

philippn / file-collect-import

philippn

Package info

gitlab.com/public2026/file-collect-import

Issues

pkg:composer/philippn/file-collect-import

Statistics

Installs: 59

Dependents: 0

Suggesters: 0

Stars: 0

dev-main 2026-11-20 22:49 UTC

This package is auto-updated.

Last update: 2026-11-20 20:50:38 UTC


README

Collect text files from a project using include and exclude patterns.

Naming conventions

Any file name starting with _ is an internal implementation file and must never be used directly.

Use the public API instead.

Usage

FilesContext::***()

Patterns

Patterns are relative to the collection root and match files only.

PatternMeaning
index.phpExact file in the root
src/index.phpExact relative file path
*.phpPHP files in the root
src/*.phpPHP files directly inside src
**.phpPHP files at any depth, including the root
ENV/**All files under ENV, at any depth

Wildcards

  • * — zero or more characters, excluding /.
  • ** — zero or more characters, including /.

Patterns must match the complete relative file path. Matching is case-sensitive.

Directories are traversal mechanisms only; patterns select files, never directories.

Exclusions

Prefix a pattern with ! to exclude matching files.

  • All inclusion patterns are processed first.
  • All exclusion patterns are applied afterward.
  • Exclusions always take precedence, regardless of rule order.
  • Exclusions filter already-selected files and never initiate traversal.

Example:

[
    '**.php',
    'config/**',
    '!vendor/**',
    '!**.min.php',
]

Built-in exclusions

The collector always excludes:

  • Directories: .git, .idea
  • Files: composer.lock
  • .env* files, except names containing .dist. or ending in .dist
  • File suffixes: .min.js, .min.css
  • Binary files
  • Symbolic links

Examples:

FilenameResult
.envExcluded
.env.localExcluded
.env.productionExcluded
.env.distIncluded
.env.dist.localIncluded
.env.local.distIncluded

Collection behavior

  • Exact patterns resolve directly to files.
  • Wildcard patterns traverse from the longest literal directory prefix.
  • No project-wide file index is built.
  • File contents are read after selection, exclusion filtering, and confirmation.