List of composer commands might be useful

Syed Sirajul Islam Anik
2 min readAug 13, 2020

--

Image from: https://mauricius.dev/images/composer.png

I use a few composer commands which sometimes I need to look at, by pressing the up arrow in my terminal. So, I thought I could group them up and write an article to share so that I don’t have to look for a list of commands to get the exact one.

If you’re running the install command from your local environment doesn’t fulfill the platform requirement ext-* but have it in your container then you can run the following which will ignore the platform requirement.

composer [require|update|install] --ignore-platform-reqs

If your containers run out of memory (Maximum allowed memory allocation problem) you can run the following command.

COMPOSER_MEMORY_LIMIT=-1 composer [command_here]

If your composer [command] screen is frozen, and you want to know if it’s working or not, use the following -vvv flag to print out all the debug logs.

COMPOSER_MEMORY_LIMIT=-1 composer update -vvv

To clear all the cached packages.

composer [clearcache|clear-cache|cc]

Remove any specific package from your composer.json file.

composer remove vendor-name/package-name

Show a list of the packages installed with their version number.

composer show# alias
composer info

List of packages installed, provided by the vendor.

composer show 'guzzlehttp/*'

Check the list of root level required packages (with dev).

composer show -s

Show the tree of a required package.

composer show --tree vendor-name/package-name

Check why a package was installed.

composer why [--tree] vendor-name/package-name# alias
composer depends [--tree] vendor-name/package-name

Check why a package version was not installed.

composer why-not vendor-name/package-name VERSION.NUMBER# alias
composer prohibits vendor-name/package-name VERSION.NUMBER

Shows if you modified a package locally in vendor directory.

composer status -v

Visit the package’s repository.

composer home vendor-name/package-name

Shows a list of new updates of the installed packages.

composer outdated

Finally, view all the list of available commands.

composer list

Happy coding ❤

--

--

Syed Sirajul Islam Anik

software engineer with "Senior" tag | procrastinator | programmer | !polyglot | What else 🙄 — Open to Remote