Is “content-hash” a mandatory part of composer.lock?

Purpose of the content hash As you can see in Composer\Package\Locker::getContentHash(), the content hash takes into account the following fields of composer.json: $relevantKeys = array( ‘name’, ‘version’, ‘require’, ‘require-dev’, ‘conflict’, ‘replace’, ‘provide’, ‘minimum-stability’, ‘prefer-stable’, ‘repositories’, ‘extra’, ); The only reason for the content hash to change is a change of one of the values of … Read more

How to use a specific tag/version with composer and a private git repository?

How to require a specific Git tag? Change the version requirement to dev-master, followed by a hash # and the Git tag name, e.g. v0.5.0, like so: “require”: { “vendor/package”: “dev-master#v0.5.0” } How to require a specific Git commit? Change the version requirement to dev-master, followed by a hash # and the Git commit reference, … Read more

How to add non-public repositories from command line with composer?

You can run the following from the project root to add a repository to the project’s composer.json: composer config repositories.repo-name vcs https://github.com/<orgname or username>/repo Then you can require the specific repo with: composer require <orgname or username>/repo:dev-branchname The Composer documentation covers it at Modifying Repositories (CLI: composer config).

Cannot update yii2 via composer bower-asset/jquery could not be found

Finally fixed it, just followed the steps on the UPGRADE.md doc If you are using Composer to upgrade Yii, you should run the following command first (once for all) to install the composer-asset-plugin: composer global require “fxp/composer-asset-plugin:^1.2.0” (See http://www.yiiframework.com/doc-2.0/guide-start-installation.html#installing-from-composer for latest version.) You may also need to add the following code to your project’s composer.json … Read more

Composer [UnexpectedValueException] error will trying to use composer to install a github project

I started getting a similar error and the reason was that Github recently changed the format of their auth tokens: https://github.blog/changelog/2021-03-31-authentication-token-format-updates-are-generally-available/ To resolve the error: Find the composer/auth.json file (if you’re running the project in a container, you’ll have to bash into it and find the file in there) Remove its github.com entry. Your file … Read more

Remove composer

During the installation you got a message Composer successfully installed to: … this indicates where Composer was installed. But you might also search for the file composer.phar on your system. Then simply: Delete the file composer.phar. Delete the Cache Folder: Linux: /home/<user>/.composer Windows: C:\Users\<username>\AppData\Roaming\Composer That’s it.