mapali/codex-dump
Composer 安装命令:
composer require mapali/codex-dump
包简介
Export all PHP files in a Laravel codebase into a single file for AI ingestion or analysis.
README 文档
README
Codex Dump is a Laravel package designed to consolidate and export your project's PHP source files into a single structured text file. This streamlined output serves as optimized context input for AI-driven code assistance tools like ChatGPT, Codex, or similar systems.
Features
- Selective Export: Define directories and file types to include or exclude.
- Token Management: Prevents exceeding AI token limits by providing token estimations and configurable maximum limits.
- Persistent History: Remembers previously used directories and file paths for rapid reuse.
- Interactive CLI: Offers intuitive prompts for quick and accurate configuration.
- Automatic File Structure: Clearly documents the exported file structure for easy AI interpretation.
Installation
Install using Composer:
composer require mapali/codex-dump --dev
Publish the configuration (optional):
php artisan vendor:publish --provider="Mapali\CodexDump\CodexDumpServiceProvider" --tag="config"
Configuration
By default, the package exports all .php files, excluding commonly ignored directories (vendor, node_modules, .git, storage). Customize these options via config/codex-dump.php:
return [ 'ignore_dirs' => [ 'vendor', 'node_modules', 'storage', '.git', ], 'extensions' => [ 'php', ], 'default_output' => base_path('codex_dump.txt'), 'max_tokens' => 10000, ];
ignore_dirs: Directories to skip.extensions: File extensions to include.default_output: Default path for the exported text file.max_tokens: Maximum allowed tokens to ensure compatibility with AI models.
Usage
To export your project's codebase, run:
php artisan codex:dump
You'll be interactively prompted for:
- Base directory: Directory path to scan (default: current directory).
- Output file path: Path for the resulting
.txtfile.
The package will then:
- Calculate the estimated token usage.
- Validate against configured token limits.
- Generate a neatly structured
.txtfile containing your project's files, clearly delineated for optimal AI ingestion.
Example output structure:
>>> FILE TREE
├── src/
│ ├── Commands/
│ │ └── DumpCodebaseCommand.php
│ └── Support/
│ └── CodexDumper.php
>>> src/Commands/DumpCodebaseCommand.php
<?php
declare(strict_types=1);
// [file contents here]
>>> src/Support/CodexDumper.php
<?php
declare(strict_types=1);
// [file contents here]
Recommended Use
Codex Dump streamlines preparing codebases for AI-assisted development. It is ideal for:
- Providing comprehensive context to AI coding assistants like ChatGPT.
- Quick reference exports for structured AI interactions.
- Facilitating efficient onboarding and understanding of large codebases.
Testing
The package includes comprehensive tests to ensure reliability:
vendor/bin/phpunit
Contributing
Contributions are welcome. Please submit pull requests or issues directly to the GitHub repository.
License
Codex Dump is released under the MIT License.
mapali/codex-dump 适用场景与选型建议
mapali/codex-dump 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 05 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mapali/codex-dump 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mapali/codex-dump 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-18