Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between composer update and composer global update

What are the differences between composer update and composer global update in yii2?

like image 368
Mohammad Aghayari Avatar asked Nov 13 '16 18:11

Mohammad Aghayari


People also ask

What does composer global update do?

Composer allows you to install dependencies globally or per-project (the default). This is merely a helper to manage a project stored in a central location that can hold CLI tools or Composer plugins that you want to have available everywhere.

Should I composer update?

You should never use composer update without argument. composer update reads every package listed on composer. json, and updates it to the latest available version compatible with the specified version constraints. In a perfect world, all librairies would follow semver correctly, and it shouldn't have any side effects.

What is difference between composer require and install?

composer install is for installing all packages of new application (all mentioned in composer. json ), use: composer install. composer require is for adding a new package, use: composer require symfony/symfony. composer update is for updating current dependencies, use: composer update.

What is difference between composer json and composer lock?

lock file is present resolves and installs all dependencies that you listed in composer. json , but Composer uses the exact versions listed in composer. lock to ensure that the package versions are consistent for everyone working on your project. As a result you will have all dependencies requested by your composer.


1 Answers

It's not anything to do with Yii directly.

Composer allows you to install dependencies globally or per-project (the default).

https://getcomposer.org/doc/03-cli.md#global

This is merely a helper to manage a project stored in a central location that can hold CLI tools or Composer plugins that you want to have available everywhere.

You might want to install something like phpunit or phpcs globally (so it's available for every project) whereas installing a library or framework that you need for your project should be a per-project installation.

like image 186
bcmcfc Avatar answered Sep 18 '22 13:09

bcmcfc