What is the difference between pipe and douoble pipe in composer.json file? For example:
"^1.0.0 || ^2.0.0"
and
'^1.0.0|^2.0.0'
There is no difference - composer. phar is the executable and composer can be an alias or symlink for it, depending on the way you've installed composer.
It is a PHAR (PHP archive), which is an archive format for PHP which can be run on the command line, amongst other things. Now run php composer.phar in order to run Composer.
composer update is mostly used in the 'development' phase, to upgrade our project packages. composer install is primarily used in the 'deploying phase' to install our application on a production server or on a testing environment, using the same dependencies stored in the composer.
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.
They're the same.
If you look into the VersionParser class (https://github.com/composer/semver/blob/1dd67fe56c0587d0d119947061a6bfc9863c101c/src/VersionParser.php#L237) you can see the following code:
$orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
As we can see in the regex, they're is a ? after the second pipe, making it optional.
It seems that only the double pipe is documented though. (https://getcomposer.org/doc/articles/versions.md#range)
I thinks it´s the old syntax of the composer OR logical operator. I found this reference: http://qpleple.com/understand-composer-versions (search for the pipe character)
In the introduction it says:
Here are some extracts from Composer's documentation reorganized to better understand how package versions and stability work
but I couldn't found any reference in current composer documentation, then I assume this is from an old version of the docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With