Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make composer to use an exact SHA1 value?

I want to make sure composer is using an exact version of a git repository by specifing the SHA1 of the commit. How can I do this?

I tried just putting the sha1 code into the version string, but this does not work:

 [UnexpectedValueException]                                                   
 Could not parse version constraint a93cbe224a6922f181f55c7a35bde0cf61a6a5a4  
like image 826
BetaRide Avatar asked Jan 10 '13 11:01

BetaRide


People also ask

What is require Dev in composer?

The package will not be installed unless those requirements can be met. require-dev (root-only) Lists packages required for developing this package (1), or running tests, etc. The dev requirements of the root package only will be installed if install is run with --dev or if update is run without --no-dev .

What is minimum stability in composer?

An alternative is to set your minimum-stability to dev, but tell composer you want to use stable whenever possible: "minimum-stability": "dev", "prefer-stable" : true. This basically means it will always use stable UNLESS there is no way to install a stable dependency, and therefore use dev.

What is composer Phar?

Composer is a dependency management tool for PHP projects. It allows you to declare the libraries your project requires and installs/updates them for you. It is deployed as a PHAR (PHP Archive) file. Phar is already enabled by default on your DreamHost server.

What is a composer Metapackage?

metapackage: An empty package that contains requirements and will trigger their installation, but contains no files and will not write anything to the filesystem. composer-plugin: A package of type composer-plugin may provide an installer for other packages that have a custom type.


2 Answers

You can specify it after the version, as such (assuming you want the master branch): "dev-master#a93cbe224"

Read more about requirements in the composer docs

like image 59
Seldaek Avatar answered Nov 02 '22 00:11

Seldaek


For Drupal stuff, you can do things like this, if you want to pin to a specific release:

composer require --dev drupal/rules:8.3.x-dev#f089923e84fdbc81f4101a684a3f1418ff1da51e

The -unstableN style Drupal tags are not available on packagist.

like image 31
Nick Avatar answered Nov 01 '22 22:11

Nick