Question

I just learned about composer and are about to use it for the first time in a bigger project. One problem I have: My project is actually about 24,5MB, 24 of those come from my vendors directory.

As far as I see, in most libraries included in vendors, composer also delivers documentation files, testings and so on. Is there an automated way to leave out all those? I just want to pack the license and the really needed source files into the final build.

Thanks a lot! :-)

Was it helpful?

Solution 2

Although I asked this question more than a year ago, it still is up to date for me. Just wanted to post the solution i eventually went with.

I found a very cool project named 'altax' -> http://kohkimakimoto.github.io/altax/. It allowed me to integrate all steps I needed to take in a fully controllable deploy process.

My final deploy command will first update all vendors and then run phpunit just to make sure. If all goes fine, it copies the current project entirely and leaves out all useless stuff (like .git, doc folders, tests, and so on). This shrinks my project from 25 to ~2.4 MB.

To finish things, it will build and bundle the documentation and create two releases - one zipped and ready to place in the update channel and one which is going to sales.

Best part is that I wrote the deployment myself with some easy tools and can fully control what it does.

OTHER TIPS

The most obvious option that Composer offers is to run the install step with --no-dev option to leave out any stuff that is require-dev, i.e. a copy of PHPUnit and other things dedicated for development.

The only other option is to use --prefer-dist to download a ZIP file with the software version instead of cloning it from the source repository.

Apart from that Composer does not influence the packaging of downloaded and included software on it's own - it just downloads the ZIP file (which might be a reduced copy of the original repository), or clones it (which is the biggest variant of all).

If you already installed packages without any of my suggested command line options, it might be a good idea to delete the vendors directory completely and run another composer update --prefer-dist in order to get rid of any cloned repositories and replace them with a downloaded version.

Note that requiring development versions like dev-master or allowing to use dev-stable packages via minimum-stability:dev is not really recommended. It usually leads to cloning the repository.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top