Composer Cheat Sheet

You can use Composer to create new projects from an existing package.

composer create-project laravel/laravel folder_name  

The install command reads the composer.json file from the current directory, resolves the dependencies, and installs them into vendor.

composer install  

In order to get the latest versions of the dependencies and to update the composer.lock file, you should use the update command. This command is also aliased as upgrade as it does the same as upgrade does if you are thinking of apt-get or similar package managers.

composer update  

If you need to update the autoloader because of new classes in a classmap package for example, you can use dump-autoload to do that without having to go through an install or update.

composer dump-autoload [--optimize]  

To update Composer itself to the latest version, run the self-update command. It will replace your composer.phar with the latest version.

composer self-update  

Information referenced from and more detail can be found at: https://getcomposer.org/doc/03-cli.md