Composer Require tip

Posted by Andy Huggins on January 29, 2016

We all know that when you find that perfect package on Packagist.org and you want to add it to your project, you go to the terminal and run `$ composer require namespace/package` and Composer goes and installs it.

Simple. Beautiful.

But what if you are interested in just adding something to your composer.json file, and don't want it to run the install of that package immediately? Easy. You run `$ composer require namespace/package --no-update` and Composer will update your composer.json file, but will not run the install.

This may not seem useful, but if you build an installer for a project and need to update a base composer.json file....this comes in handy.

Also, another flag you can use if Composer runs into issues is the `--no-scripts` flag. This is can sometimes fix an issue when running ` $ composer install` you can instead run `$ composer install --no-scripts` and Composer will not execute the scripts and will complete. When Composer completes it updates the composer.lock file, which if that gets out of sync can cause issues.

Anyway, a couple little Composer tips.