Download the PHP package codebase-dump/php without Composer
On this page you can find all versions of the php package codebase-dump/php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codebase-dump/php
More information about codebase-dump/php
Files in codebase-dump/php
Package php
Short Description Generate a single-file dump of your repository for LLM input
License MIT
Informations about the package php
Codebase Dump (PHP)
An AI-assisted PHP 8.4 port of the Python codebase-dump tool. It generates a single-file dump of your repository for LLM input.
Rationale
I was frustrated that I didn't find a native PHP tool for this task. The tools I did find, were written in Python, NodeJS and Rust and all of them came with environment/dependency issues I didn't want to deal with. With the help of some AI coding tools, I generated this port. It hasn't been tested extensively, but I've used it on a few projects and it seemed to work fine.
Description
This tool analyzes one or more codebase directories and generates a structured text or markdown representation that can be used as input for Large Language Models (LLMs). It:
- Recursively analyzes directory structures
- Supports multiple directories, merged into a single output tree
- Identifies and ignores common non-source files (compiled code, dependencies, etc.)
- Reads text file contents
- Generates tree representations
- Calculates file sizes and estimates token counts
- Supports custom ignore patterns (via
.gitignoreand.cdigestignore) - Optionally uploads results to the Code Audits API
Requirements
- PHP 8.4 or higher
- Composer for dependency management
Installation
Usage
Basic Usage
Command Line Options
Examples
Features
Ignore Patterns
The tool supports the following default ignore patterns:
- Python:
*.pyc,*.pyo,*.pyd,__pycache__ - JavaScript:
node_modules,bower_components - Version Control:
.git,.svn,.hg,.gitignore - Virtual Environments:
venv,.venv,env - IDE:
.idea,.vscode - Temporary Files:
*.log,*.bak,*.swp,*.tmp - OS Files:
.DS_Store,Thumbs.db - Build:
build,dist,*.egg-info - Compiled Libraries:
*.so,*.dylib,*.dll
Additionally, the tool reads patterns from:
.gitignore- Standard Git ignore patterns.cdigestignore- Custom ignore file (same format as.gitignore)
Output Formats
Text Format (Default)
Generates a plain text file with:
- Directory structure tree
- Summary statistics
- List of ignored files
- Full file contents
Markdown Format
Generates a Markdown file with:
- Directory structure tree
- Summary statistics
- List of ignored files
- File contents in code blocks
API Usage
You can also use the library programmatically in your PHP code:
Development
Running Tests
Project Structure
Differences from Python Version
- Token Counting: Uses simple whitespace tokenization. For more accurate token counts (matching GPT models), consider integrating a library like
openai-php/tiktoken. - Pattern Matching: Implements basic fnmatch-style pattern matching. The Python version uses
py_walkfor more advanced glob patterns.
License
MIT