Detect and Clean Up Unchanged Vendor Files with Laravel Vendor Cleanup
Last updated on by Yannick Lyn Fatt
Ever wondered which of your published Laravel config files you’ve actually customized? After years of development, published vendor files accumulate—some modified, many untouched, others orphaned from long-removed packages. This cruft makes your codebase harder to navigate and can cause confusion during package upgrades.
Laravel Vendor Cleanup by Chris Jones provides Artisan commands that intelligently compare your published vendor files with their originals. It strips comments, optionally normalizes whitespace, then uses SHA256 hashing to show exactly which files you've modified (with color-coded diff percentages), which are identical to vendor (safe to delete), and which are orphaned from removed packages.
Clean up cruft, track your customizations, and upgrade packages with confidence—all with simple artisan commands.
Features
- Smart Comparison: Automatically strips PHP comments and optionally normalizes whitespace
- Diff Percentages: See exactly how different your files are from vendor originals
- Color-Coded Output: Green 🟢, Yellow 🟡, Magenta 🟣 or Red 🔴 based on the difference percentage
- Safe Cleanup: Optionally delete unchanged files with confirmation
- Orphan Detection: Find files from uninstalled packages
- Handles Timestamps: Smart migration filename matching (strips timestamps)
- Stub Support: Detects both
.phpand.php.stubvendor files
Available Commands
Here are the commands that are available at the time of writing:
php artisan vendor-cleanup:config php artisan vendor-cleanup:migration php artisan vendor-cleanup:lang php artisan vendor-cleanup:view
Example
Here is an example of the output from the vendor-cleanup:config artisan command:
$ php artisan vendor-cleanup:config MODIFIED+---------------------+------------+| File | Difference |+---------------------+------------+| config/services.php | 25.7% || config/app.php | 22% || config/mail.php | 4.7% || config/cache.php | 3% || config/queue.php | 1.7% || config/database.php | 0.8% || config/session.php | 0.4% || config/apiroute.php | 0.1% |+---------------------+------------+ UNCHANGED (matches vendor)+--------------------+------------------------+| File | File |+--------------------+------------------------+| config/auth.php | config/filesystems.php || config/logging.php | |+--------------------+------------------------+ MISSING (not published locally)+-------------------------------------------------------------------+--------------------------------------------+| File | File |+-------------------------------------------------------------------+--------------------------------------------+| laravel/boost/config/boost.php | laravel/framework/config/broadcasting.php || laravel/framework/config/concurrency.php | laravel/framework/config/cors.php || laravel/framework/config/hashing.php | laravel/framework/config/view.php || laravel/mcp/config/mcp.php | laravel/tinker/config/tinker.php || mrpunyapal/laravel-extended-commands/config/extended-commands.php | spatie/laravel-data/config/data.php || spatie/php-structure-discoverer/config/structure-discoverer.php | symfony/http-kernel/config/FileLocator.php |+-------------------------------------------------------------------+--------------------------------------------+ Done.
Give this package a try on an existing project and see what it finds for you. Learn more and view the source code on GitHub.