简体   繁体   中英

Is there a way to download composer package without dev folders?

I want to minimize traffic usage with composer packages load, so I need for production loads to only download the source/lib folders without examples/docs/readme.

I haven't found any information in the official composer documentation.

UPD

One of the best solution - add .gitattributes file into your project and add main rows from this gist

This is not really up to composer and instead a responsibility of package maintainers. You can use --prefer-dist to install a distribution instead of checking out the git repository as is usually done during development, but what this distribution contains is managed by the package maintainer.

If the packages you install allow for pull requests & issues, you could ask them to provide a .gitattributes file which is recognized by github when creating an archive or provide a pull request providing one. In this file you can specify which files and folders will be excluded from the archive using export-ignore . In any case since everything is bundled in a zip the bandwidth saved is probably negligible.

So, short answer is the only way to minimize bandwidth usage and allocated disk space for dependencies is using the --prefer-dist option - and omitting dev dependencies with --no-dev - when installing them for production.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM