{"id":43065455,"url":"https://github.com/vangelis183/repophp","last_synced_at":"2026-01-31T12:38:35.223Z","repository":{"id":279117669,"uuid":"937221865","full_name":"vangelis183/repophp","owner":"vangelis183","description":"RepoPHP packs a repository into a single AI-friendly file for LLM processing","archived":false,"fork":false,"pushed_at":"2025-06-16T20:00:27.000Z","size":31887,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-20T10:12:52.489Z","etag":null,"topics":["ai","anthropic","anthropic-claude","chatbot","claude","developer-tools","generative-ai","language-model","llm","openai","php","repository"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vangelis183.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"vangelis183"}},"created_at":"2025-02-22T16:17:07.000Z","updated_at":"2025-05-12T18:33:25.000Z","dependencies_parsed_at":"2025-05-12T19:47:52.656Z","dependency_job_id":null,"html_url":"https://github.com/vangelis183/repophp","commit_stats":null,"previous_names":["vangelis183/repophp"],"tags_count":8,"template":false,"template_full_name":"spatie/package-skeleton-php","purl":"pkg:github/vangelis183/repophp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vangelis183%2Frepophp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vangelis183%2Frepophp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vangelis183%2Frepophp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vangelis183%2Frepophp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vangelis183","download_url":"https://codeload.github.com/vangelis183/repophp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vangelis183%2Frepophp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28943627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T12:10:04.904Z","status":"ssl_error","status_checked_at":"2026-01-31T12:09:58.894Z","response_time":128,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","anthropic","anthropic-claude","chatbot","claude","developer-tools","generative-ai","language-model","llm","openai","php","repository"],"created_at":"2026-01-31T12:38:34.535Z","updated_at":"2026-01-31T12:38:35.215Z","avatar_url":"https://github.com/vangelis183.png","language":"PHP","funding_links":["https://github.com/sponsors/vangelis183"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# RepoPHP\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/vangelis/repophp.svg?style=flat-square)](https://packagist.org/packages/vangelis/repophp) [![Tests](https://img.shields.io/github/actions/workflow/status/vangelis183/repophp/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/vangelis183/repophp/actions/workflows/run-tests.yml) [![Total Downloads](https://img.shields.io/packagist/dt/vangelis/repophp.svg?style=flat-square)](https://packagist.org/packages/vangelis/repophp)\n\n\u003c/div\u003e\nRepoPHP is a PHP package that packs a repository into a single AI-friendly file for LLM processing. Similar to [repomix](https://github.com/yamadashy/repomix)\n\n## Demo\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"demo/repophp-demo.gif\" alt=\"RepoPHP Demo\" width=\"800\"\u003e\n\u003c/div\u003e\n\n## Installation\n\nYou can install the package via composer:\n\n```bash  \ncomposer require vangelis/repophp --dev\n```  \n\n## Configuration File\n\nRepoPHP supports a configuration file to set default options. Create one of these files in your project directory:\n- `.repophp.json`\n- `repophp.json`\n- `.repophp.config.json`\n- `repophp.config.json`\n\nExample configuration file:\n\n```json\n{\n  \"repository\": \"/path/to/repository\",\n  \"output\": \"packed_repo.txt\",\n  \"format\": \"markdown\",\n  \"encoding\": \"cl100k_base\",\n  \"exclude\": [\".env.local\", \"*.log\"],\n  \"no-gitignore\": false,\n  \"compress\": true,\n  \"max-tokens\": 100000,\n  \"remote\": false,\n  \"branch\": \"main\",\n  \"incremental\": false,\n  \"base-file\": null\n}\n```\n\nWith this configuration file in place, you can simply run:\n\n```bash\nvendor/bin/repophp pack\n```\n\nCommand-line arguments will override settings from the configuration file.\n\n  \n## Usage  \n## Pack Command Usage  \n  \nYou can use the `pack` command to package a local repository directory into a single file, suitable for processing by AI-based systems.  \n  \n### Available Options for the pack Command:\n\n#### Required Arguments:\n- **output**: The path to the `output` file where the packed content will be stored.\n\n- **repository**: The path to the `repository` directory that you want to pack or a remote repository URL if used with the  --remote flag.\n\n#### Optional Flags and Settings:\n- **--remote, -rem:**\nTreat the repository argument as a remote Git repository URL.\n\n- **--branch \u003cbranch\u003e, -bra \u003cbranch\u003e (default: main):**\nBranch to checkout when cloning a remote repository.\n\n- **--format \u003cplain|markdown|json|xml\u003e, -fmt \u003cformat\u003e (default: plain):**\nSpecifies the format of the output file. Supported formats:\n\n  - `plain`: Plain text format.\n  - `markdown`: Markdown format for better readability.\n  - `json`: JSON format for structured data.\n  - `xml`: XML format for structured data.\n\n- **--encoding \u003cencoding\u003e, -enc \u003cencoding\u003e (default: p50k_base):**\nToken encoding to use (cl100k_base, p50k_base, r50k_base, p50k_edit).\n\n- **--exclude \u003cpattern\u003e, -exc \u003cpattern\u003e:**\nAdditional file patterns to exclude during the packing process.\nThese patterns are added to the default exclusions (e.g., .env, composer.lock, etc.).\nThis option can be used multiple times to add multiple patterns.\n\n- **--max-tokens \u003cnumber\u003e, -max \u003cnumber\u003e (default: 0):**\nMaximum number of tokens per output file. If set to a positive number, the repository will be split into multiple files when the token limit is reached. Set to 0 (default) for no limit.\n\n- **--no-gitignore, -nog:**\nIf this flag is provided, .gitignore files will not be used to exclude files.\n\n- **--compress, -com:**\nRemove comments and empty lines from files for more compact output.\n  \n### Example Usage  \n  \n**Local repository:**\n  \n```bash  \nvendor/bin/repophp pack output.txt /path/to/repository --format=json --exclude=\"*.log\" --exclude=\".env.local\" --no-gitignore --compress  \n```  \n\n**Remote Repository:**\n\n```bash\nvendor/bin/repophp pack output.txt https://github.com/username/repository.git --remote --branch develop\n```\n\n**With short option names:**\n\n```bash\nvendor/bin/repophp pack output.txt /path/to/repo -fmt json -com -enc cl100k_base\n```\n\n**Complex example:**\n\n```bash\nvendor/bin/repophp pack output.txt https://github.com/vangelis183/repophp.git --remote --branch main --compress --encoding cl100k_base --format plain\n```\n\n**Split large repository by token count:**\n\n```bash\nvendor/bin/repophp pack output.txt /path/to/repo --max-tokens=100000 --encoding cl100k_base\n```\n\n**Incremental packing (diff mode):**\n\n```bash\nvendor/bin/repophp pack output.txt /path/to/repo --incremental --base-file=/path/to/previous/pack.txt\n```\nThis will create a diff file containing only files that have changed since the previous pack, which is especially useful for large repositories where you only want to analyze recent changes.\n\n#### Breakdown:\n- Packs the repository located at `/path/to/repository` or clones the remote repository URL.\n- Stores the packed content in `/path/to/output.txt`.\n- Uses the specified output format (json, plain, markdown, or xml).\n- Excludes files matching the specified patterns.\n- Option to ignore `.gitignore` rules.\n- Option to compress the output by removing comments and empty lines.\n- For remote repositories, checks out the specified branch.\n- Uses the specified token encoding for calculating token counts.\n\n### Additional Behavior\n- **Overwrite Handling**:    \nIf the output file already exists, you will be prompted to confirm whether you want to overwrite the file. If you choose not to overwrite, a new file will be created with a timestamp appended to its name.\n\n- **Supported Formats**:    \n  The following formats are supported (as defined in `RepoPHP`):\n    - `plain`\n    - `markdown`\n    - `json`\n    - `xml`\n\n- **Default Exclusions**:    \n  Some files are excluded automatically during the packing process (e.g., `.env`, `composer.lock`, and other commonly ignored files). The list of default exclusions can be found in the `RepoPHP` class.\n\n### Error Handling\n\nThe `pack` command gracefully handles errors such as:\n- Invalid repository paths.\n- Invalid output paths.\n- Unsupported output formats.\n- Failures in creating or writing the output file.\n\nIf any error occurs, an appropriate error message will be shown in the console.\n\n## Testing\n\n```bash  \ncomposer test\n```  \n  \n## Changelog  \n  \nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.  \n  \n## ToDos  \n- [x] Move settings to configuration\n- [x] Git Repositiory Information\n- [x] Directory structure\n- [x] More tests  \n- [x] Token Count for each file and entire repo\n- [x] Consider different encodings\n- [x] Add compression (Comments etc.)\n- [x] Add option for remote Git Repositories\n- [x] Add option for specific branch\n- [x] Add repository splitting for large codebases\n- [x] Implement incremental/diff-based packing\n- [x] Add editable custom config to override defaults\n- [ ] Add security checks for files (Keys, Passwords etc.)\n- [ ] Create advanced filtering options (by date, content)\n- [ ] Add repository analytics and metrics\n- [ ] Implement model-specific optimization profiles\n- [ ] Develop CI/CD integration options\n- [ ] Build interactive CLI mode\n\n## Ideas   \n\n\n  \n## Contributing  \n  \nPlease see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.  \n  \n## Security Vulnerabilities  \n  \nIf you've found a bug regarding security please use the issue tracker.  \n  \n## Credits  \n  \n- [Evangelos Dimitriadis](https://github.com/vangelis183)  \n  \n## License  \n  \nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvangelis183%2Frepophp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvangelis183%2Frepophp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvangelis183%2Frepophp/lists"}