visavi/cleanup 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

visavi/cleanup

Composer 安装命令:

composer require visavi/cleanup

包简介

Cleaning vendor directory

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License

Cleaning composer vendor directory

A zero-dependency CLI script that strips development junk from your vendor directory: tests, documentation, CI configs, dotfiles, editor settings and other files that packages ship but your application never loads at runtime.

Useful when deploy size matters: shared hosting with inode/disk quotas, Docker images, serverless bundles, or just keeping backups smaller. Depending on the dependencies, it typically shaves off 10–30% of vendor size and thousands of files.

How it works

The script walks the vendor tree and deletes files and directories matching the built-in pattern list (see below). Matching is case-insensitive, so tests, Tests and TESTS are all caught.

Safety measures:

  • Symlinks are never followed. A symlinked package (e.g. a composer path repository) is left untouched, and symlinks inside deleted directories are removed as links only — the target survives.
  • Refuses to run outside vendor. The script checks that it is installed next to vendor/autoload.php and exits otherwise, so an accidental run from a repo checkout cannot sweep your home directory.
  • Dry mode. Run with --dry first to preview what would be deleted.

Note: cleaning vendor is meant for the final deploy artifact. After cleanup, things like composer dump-autoload, package tests or docs are gone — reinstall with composer install to get them back. Some licenses formally require the license text to be distributed with the code; keep that in mind and use --exclude license if it matters for your case.

Requirements

PHP >= 8.0

Installing

composer require visavi/cleanup

Run

./vendor/bin/cleanup

Preview without deleting:

./vendor/bin/cleanup --dry

Options

Option Short Description
--help -h Display help message
--include -i Add patterns to the built-in list, comma separated
--exclude -e Remove patterns from the built-in list, comma separated
--verbose -v Print every deleted file instead of progress dots
--path -p Clean only a specific path inside vendor
--dry -d List what would be deleted without removing anything

Examples

Clean only symfony packages, also delete archives, but keep docs and tests:

./vendor/bin/cleanup -v --path symfony --include '*.zip,*.rar' --exclude doc,docs,test

Keep license files:

./vendor/bin/cleanup --exclude license

Typical deploy step:

composer install --no-dev --optimize-autoloader
./vendor/bin/cleanup

Default patterns

  • .git
  • .github
  • .circleci
  • .idea
  • .vscode
  • .psalm
  • .temp
  • test
  • tests
  • demo
  • example
  • examples
  • doc
  • docs
  • benchmark
  • benchmarks
  • license
  • authors*
  • changelog*
  • changes*
  • faq*
  • contributing*
  • history*
  • upgrading*
  • upgrade*
  • readme*
  • makefile
  • *.yml
  • .*.yml
  • *.yaml
  • .*.yaml
  • *.md
  • *.rst
  • *.txt
  • *.dist
  • *.neon
  • *.cache
  • phpunit.xml
  • phpcs.xml
  • psalm.xml
  • .php_cs*
  • .php-cs-fixer*
  • .gitignore
  • .gitattributes
  • .gitmodules
  • .editorconfig
  • .dockerignore
  • .mailmap
  • .ds_store
  • .phpstorm.meta.php
  • dockerfile*
  • docker-compose*
  • composer.lock

License

The class is open-sourced software licensed under the MIT license

visavi/cleanup 适用场景与选型建议

visavi/cleanup 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 55.73k 次下载、GitHub Stars 达 23, 最近一次更新时间为 2017 年 01 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「composer」 「clean」 「vendor」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 visavi/cleanup 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 visavi/cleanup 我们能提供哪些服务?
定制开发 / 二次开发

基于 visavi/cleanup 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 55.73k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 24
  • 点击次数: 25
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 23
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-11