Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Vendor Cleanup

Laravel Vendor Cleanup Laravel Package

barryvdh/laravel-vendor-cleanup

Removes unused or redundant files from your Laravel vendor directory, keeping it lean for deployment. Cleans up docs, tests, and other cruft from installed packages to reduce upload size and speed up deploys.

View on GitHub
Deep Wiki
Context7

A vendor cleanup package, to remove tests and documentation to save space

Frequently asked questions about Laravel Vendor Cleanup
What does barryvdh/laravel-vendor-cleanup do?
It is a Laravel Artisan utility that removes unused or redundant files such as documentation, tests, and examples from your vendor directory. The goal is to reduce the size of deployment artifacts and speed up uploads or image pulls. It is a build or deploy-time tool, not a runtime dependency for your application architecture.
How do I install barryvdh/laravel-vendor-cleanup in a Laravel project?
Install it with Composer, typically as a require-dev dependency, and Laravel package discovery will register the Artisan command. You can optionally publish the vendor-cleanup.php config file if you need exclusions or custom patterns. Run the command manually once before wiring it into CI.
Can I run vendor:cleanup after composer install --no-dev?
Not if the package is installed only as a require-dev dependency, because --no-dev removes it from that build stage. It must run in a builder stage or build host where dev dependencies are present, then the pruned vendor directory is carried into the final artifact. Treat that as a pipeline design decision before implementation.
Is it safe to run vendor:cleanup in production?
The command is destructive by design because it deletes files from vendor after Composer has recorded installed state. Run it first in a disposable build artifact with dry-run enabled, inspect the deletions, and execute your test suite and a smoke deploy. Avoid running it directly on production hosts without a rehearsed rollback to an unpruned artifact.
How do I preview what vendor:cleanup will delete?
Use the command's dry-run option to list the files it would remove without changing the vendor directory. Review that output against your dependency graph, especially packages that may read their own docs, tests, fixtures, or example configs at runtime. Only remove the dry-run flag after the list is reviewed and tested.
Can I exclude packages or customize cleanup patterns?
Yes, the package supports a published config/vendor-cleanup.php file where you can define exclusions and configurable patterns. That lets you protect dependencies that need their docs, tests, or fixtures at runtime. Keep the exclusion list under review as dependencies change.
Will removing vendor tests and documentation break my Laravel application?
Usually not, because most runtime code does not read its own tests or documentation. However, some packages load fixtures, example configs, or documentation files at runtime, and those failures often appear only in production. Audit your dependency graph and smoke test the pruned build before promoting it.
Does barryvdh/laravel-vendor-cleanup work with Laravel 10 or 11?
The package is an Artisan command that operates on the vendor directory, so its Laravel version support depends on its Composer constraints rather than deep framework integration. Check the current release's composer.json for the PHP and Laravel versions it declares before adding it to your matrix. Test on your actual dependency graph because cleanup behavior is dependency-specific.
How much space does vendor cleanup actually save?
Expect modest gains, often single-digit to low-double-digit megabytes and seconds of deploy time, depending on your dependency graph. Measure vendor size and artifact size before and after on a real build. Gains are usually small next to composer install --no-dev, --prefer-dist, optimized autoloaders, and multistage builds.
When should I avoid using laravel-vendor-cleanup?
Avoid it when vendor immutability or build reproducibility is a policy, or when your deployment target is a managed PaaS where a few megabytes are noise. It is also a poor fit if you cannot add a safe builder stage or rehearse rollback. In those cases, standard Composer and Docker optimizations or inlining the pattern list into your own deploy script are better choices.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo