This is a list of common pitfalls on using Composer, and how to avoid them.
When facing any kind of problems using Composer, be sure to work with the latest version. See self-update for details.
Ensure you're installing vendors straight from your
rm -rf vendor && composer update -vwhen troubleshooting, excluding any possible interferences with existing vendor installations or
Package not found
Double-check you don't have typos in your
composer.jsonor repository branches and tag names.
Be sure to set the right minimum-stability. To get started or be sure this is no issue, set
Packages not coming from Packagist should always be defined in the root package (the package depending on all vendors).
Use the same vendor and package name throughout all branches and tags of your repository, especially when maintaining a third party fork and using
Memory limit errors
If composer shows memory errors on some commands:
PHP Fatal error: Allowed memory size of XXXXXX bytes exhausted <...>
memory_limit ini value should be increased.
Note: Composer internally increases the memory_limit to 512M. It is a good idea to create an issue for composer if you get memory errors.
Get current value:
php -r "echo ini_get('memory_limit').PHP_EOL;"
Increase limit with
php.ini for a
CLI SAPI (ex.
; Use -1 for unlimited or define explicit value like 512M memory_limit = -1
Or with command line arguments:
php -d memory_limit=-1 composer.phar <...>