In a post to his site Sarfraz Ahmed shares a command that can be used in a Laravel application (via artisan
) to clean up unnecessary files from packages that you may have installed.
When installing composer packages, they come up with lot of useless files and folders such as .git, tests, readme.md and more. When project becomes bigger with many packages, this junk takes considerable disk space. Since I work with Laravel framework most of the time, I created a command that allows me to automatically delete all these junk files whenever I happen to install or update composer packages.
He lists out the patterns the command matches by default including "tests", "readme*" and "*.log". There's a long list of items and, having worked with several packages, I can tell you that most of the files caught by this need to be removed anyway. He has posted the code on GitHub and provides some examples of the command line calls and how it can be called automatically.
Another package that does something similar but allows the package itself to define the files to remove is the composerclean library that is executed as a Composer command rather than an artisan
command.