Composer 101

Basic composer commands

Composer is the dependency manager for PHP. Use packagist.org to search for packages.

Here the basic commands for composer:

Start new php project:

composer init

Install a new packages with:

composer require packageName

Get the latest version

composer update

Uninstall packages:

composer remove packageName

Search packages

composer search packageName

Shows a list of installed packages that need to be updated:

composer outdated

You should always run the validate command before you commit your composer.json file, and before you tag a release.

composer validate

CLI documentation here.

Leave a comment or contact me via Twitter @huckbit

comments powered by Disqus

Related Posts