1
votes

Since composer was created, it made our life a lot easier. However, running composer install often ends up with so many files that can be useful for development, but just bloat the production server. Shared hosting often has limited inodes, or you must upload the "vendor" folder yourself since composer isn't on the server.

When the vendor folder has 6,000 files+ this is an issue, especially if you have multiple projects with 6,000 files each. And so many of these files are "README.MD" or "TODO". Production servers don't need the dev's "TODO" file.

I tried searching on Google but I can't find any clues, so anyone knows if there is a composer command that will install a production version?

2

2 Answers

0
votes

composer install --no-dev

The official link:

https://getcomposer.org/doc/03-cli.md#install

If you want to exclude something very specific, you want archive.

https://getcomposer.org/doc/04-schema.md#archive

"archive": {
     "exclude": ["*.md", "vendor/**/tests", "/*.test"]
}
0
votes

There was a feature request for that, but it was rejected (several times). Right now the best what you can get from Composer is:

composer install --no-dev --prefer-dist

It will skip installation dev packages and prefer dist archives, which usually does not contain tests and other files not necessary to run package on production.

If this is still not enough, you may try to use octolab/cleaner plugin.