Composer 101

April 05, 2018

php
composer
packages
backend

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.


Written by huckbit web developer who lives and works in UK building cool things. You can find me on twitter.