Skip to content

imliam/killposer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

killposer

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

Installation

killposer requires PHP 8.4+. Using Composer, you can install it globally with the following command:

composer global require imliam/killposer

Alternatively, you can use cpx to run killposer without installing it:

cpx imliam/killposer ~/projects

Usage

killposer [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:

killposer

Scan a specific path:

killposer ~/projects

Scan deeper (e.g. a monorepo with nested packages):

killposer ~/projects --depth=4

Delete without a confirmation prompt (e.g. in a script):

killposer ~/projects --force

How it works

killposer 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.

About

Interactively find and delete Composer vendor directories to reclaim disk space

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages