Iinteractively find and delete Composer vendor/ directories to reclaim disk space - like npkill but for PHP.
$ killposer ~/projects
Scanning for Composer projects... ✓
┌ Select vendor directories to delete ──────────────────────────────┐
│ › ◼ my-app · 48.3 MB · 2025-11-02 │
│ ◻ old-api · 31.1 MB · 2024-06-14 │
│ ◻ legacy-plugin · 12.7 MB · 2023-09-30 │
└───────────────────────────────────────── Space to toggle, Enter ─┘
Delete 1 vendor directory totalling 48.3 MB? No / Yes
Deleted /home/user/projects/my-app/vendor
killposer requires PHP 8.4+. Using Composer, you can install it globally with the following command:
composer global require imliam/killposerAlternatively, you can use cpx to run killposer without installing it:
cpx imliam/killposer ~/projectskillposer [options] [<path>]
| Argument / Option | Description | Default |
|---|---|---|
path |
Directory to scan | Current working directory |
--depth=N |
Maximum directory depth to scan | 2 |
-f, --force |
Delete without confirmation prompt | - |
Scan the current directory:
killposerScan a specific path:
killposer ~/projectsScan deeper (e.g. a monorepo with nested packages):
killposer ~/projects --depth=4Delete without a confirmation prompt (e.g. in a script):
killposer ~/projects --forcekillposer walks the given directory up to --depth levels deep, looking for folders that contain both a composer.json and a vendor/ directory. Results are sorted by vendor size (largest first) so the biggest wins are at the top.
Once you confirm, it deletes only the vendor/ directory - your source code is untouched. Run composer install in any project to restore it.