PHPackages                             visavi/cleanup - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. visavi/cleanup

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

visavi/cleanup
==============

Cleaning vendor directory

v2.2.0(2w ago)2356.1k↑56.9%23MITPHPPHP &gt;=8.0

Since Jan 11Pushed 2w ago1 watchersCompare

[ Source](https://github.com/visavi/cleanup)[ Packagist](https://packagist.org/packages/visavi/cleanup)[ Docs](https://visavi.net)[ RSS](/packages/visavi-cleanup/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)DependenciesVersions (12)Used By (3)

Cleanup
=======

[](#cleanup)

[![Latest Stable Version](https://camo.githubusercontent.com/3d0dce7d0c6b54d59d0b37a9eefc669c0b092ca176d5948d7494f37cedc5e297/68747470733a2f2f706f7365722e707567782e6f72672f7669736176692f636c65616e75702f762f737461626c65)](https://packagist.org/packages/visavi/cleanup)[![Total Downloads](https://camo.githubusercontent.com/bdda16c15fc967126ec82f5acedcfab14527379b072e630b6979b43e8883ba8d/68747470733a2f2f706f7365722e707567782e6f72672f7669736176692f636c65616e75702f646f776e6c6f616473)](https://packagist.org/packages/visavi/cleanup)[![Latest Unstable Version](https://camo.githubusercontent.com/0346e574d177e61bc08ccb8c372a2d7ea7e38229cd60a799b7aaf8742a627ca2/68747470733a2f2f706f7365722e707567782e6f72672f7669736176692f636c65616e75702f762f756e737461626c65)](https://packagist.org/packages/visavi/cleanup)[![License](https://camo.githubusercontent.com/84b76a75d0f360c5e60c2a4d68ac791da237229087480e332c0b2bd787240fcd/68747470733a2f2f706f7365722e707567782e6f72672f7669736176692f636c65616e75702f6c6963656e7365)](https://packagist.org/packages/visavi/cleanup)

Cleaning composer vendor directory
----------------------------------

[](#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
------------

[](#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
------------

[](#requirements)

PHP &gt;= 8.0

Installing
----------

[](#installing)

```
composer require visavi/cleanup

```

Run
---

[](#run)

```
./vendor/bin/cleanup

```

Preview without deleting:

```
./vendor/bin/cleanup --dry

```

Options
-------

[](#options)

OptionShortDescription`--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 anythingExamples
--------

[](#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
----------------

[](#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
-------

[](#license)

The class is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

61

—

FairBetter than 98% of packages

Maintenance96

Actively maintained with recent releases

Popularity39

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~344 days

Recently: every ~595 days

Total

11

Last Release

19d ago

Major Versions

v1.5.2 → v2.0.02026-06-13

PHP version history (2 changes)v1.0PHP &gt;=5.4.0

v2.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/826831?v=4)[Alexander Grigorev](/maintainers/visavi)[@visavi](https://github.com/visavi)

---

Top Contributors

[![visavi](https://avatars.githubusercontent.com/u/826831?v=4)](https://github.com/visavi "visavi (18 commits)")

---

Tags

cleancleanercleanupcomposerphpcomposercleanvendor

### Embed Badge

![Health badge](/badges/visavi-cleanup/health.svg)

```
[![Health](https://phpackages.com/badges/visavi-cleanup/health.svg)](https://phpackages.com/packages/visavi-cleanup)
```

###  Alternatives

[jean85/pretty-package-versions

A library to get pretty versions strings of installed dependencies

1.3k315.9M83](/packages/jean85-pretty-package-versions)[voku/portable-ascii

Portable ASCII library - performance optimized (ascii) string functions for php.

576437.1M171](/packages/voku-portable-ascii)[ergebnis/composer-normalize

Provides a composer plugin for normalizing composer.json.

1.1k40.0M2.8k](/packages/ergebnis-composer-normalize)[bamarni/composer-bin-plugin

No conflicts for your bin dependencies

53024.4M1.1k](/packages/bamarni-composer-bin-plugin)[composer/metadata-minifier

Small utility library that handles metadata minification and expansion.

181123.3M25](/packages/composer-metadata-minifier)[shipmonk/composer-dependency-analyser

Fast detection of composer dependency issues (dead dependencies, shadow dependencies, misplaced dependencies)

6198.4M666](/packages/shipmonk-composer-dependency-analyser)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
