Composer version pattern not working - composer-php

In my composer I've the following version definition of a module:
"my-module": "1.*"
Everything was working fine until I've changed the module tag version to 1.0.10.
The strange thing is that composer is always loading 1.0.9.
I could change the pattern to "1.0.*", but I can't find any info why "1.*" is not working.
btw. I'm using Composer version 1.4.1

To find out why a particular version is not updated, you can run composer why-not package/name version, and Composer will list all dependencies that prevent the installation of that particular version.
I have a feeling that in your case you will detect another package that you did not consider yet.

Related

Update Magento2 version 2.4.2 to 2.4.3 problem

i am trying to update Magento with the following steps
composer require magento/product-enterprise-edition=2.4.3 --no-update on composer.json archive.
run composer update
And i have these problems
Problem 1
- magento/project-enterprise-edition is present at version 2.4.2 and cannot be modified by Composer
- magento/product-enterprise-edition 2.4.3 requires vertexinc/product-magento-module-commerce 4.2.1 -> satisfiable by vertexinc/product-magento-module-commerce[4.2.1].
- vertexinc/product-magento-module-commerce[4.2.1] cannot be installed as that would require removing magento/project-enterprise-edition[2.4.2]. They both replace vertex/product-magento-module-commerce and thus cannot coexist.
- Root composer.json requires magento/product-enterprise-edition 2.4.3 -> satisfiable by magento/product-enterprise-edition[2.4.3].
Any idea how to solve this problem?
Thanks!
On first glance I'd say that while you do the composer require --no-update [--] magento/product-enterprise-edition=2.4.3 explicitly not doing any updates, the original Magento Enterprise Edition is kept locked to version 2.4.2.
Then running composer update is not updating it, resulting into the foremost problem reported (it looks leading to me, that all other problems are caused by it):
magento/project-enterprise-edition is present at version 2.4.2 and cannot be modified by Composer
It is my own understanding that the reason it cannot be modified by Composer is because magento/project-enterprise-edition is locked to 2.4.2.
Try running:
composer update magento/project-enterprise-edition
to update that package explicitly.
(I can't say - as you did not share in your question - why you did run the composer require with --no-update, it is just that with --no-update the lock file is not updated and it seems that it is in use and further on pinning magento/project-enterprise-edition to [previous!] version 2.4.2 - you want to update to 2.4.3 [!]).
Additionally, running
composer update --with-dependencies magento/project-enterprise-edition or
composer update --with-all-dependencies magento/project-enterprise-edition
may be useful to escalate follow-up issues to make the dependency update command more binding. Excerpt from composer update --help (Composer version 2.1.11 2021-11-02 12:10:2):
-w, --update-with-dependencies: Allows inherited dependencies to be updated, except those that are root requirements.
-W, --update-with-all-dependencies: Allows all inherited dependencies to be updated, including those that are root requirements.
Root requirements are those in your composer.{json,lock} file.

Can't get specific version of composer package

I am trying to get latest version of calcinai/xero-php (just doing composer require as per their readme installs v ^1.7)
When I run
composer require "calcinai/xero-php":"^2.0.4"
The incorrect version of this package is downloaded (composer logs below + vendor code being installed is not what is in master repos, currently at v2.0.4).
How do I get v2.0.4/latest code that is on master (using composer)?
If you want to require a specific version, and not any other, skip the caret. Installing exactly v2.0.4 of that package works using
composer require "calcinai/xero-php":"2.0.4"

Cannot install jacquestvanzuydam/laravel-firebird via composer

I'm running Laravel 5.5.
While trying to install jacquestvanzuydam/laravel-firebird via Composer,
but it fails. The Composer shows me:
[InvalidArgumentException]
Could not find a version of package jacquestvanzuydam/laravel-firebird matching your minimum-stability (stable). Require it with an explicit version constraint allowing its desired stability.
This package does not have any stable release. You need to specify branch in constrait directly:
composer require jacquestvanzuydam/laravel-firebird:dev-master
This will install version from master branch. List of available branches you can find or right column on https://packagist.org/packages/jacquestvanzuydam/laravel-firebird.
You may also report this issue (no stable release of this package) to package maintainer. Using branch instead of regular constraint may give unexpected compatibility breaks, you should really avoid it where possible.
Adding "minimum-stability": "dev" to composer.json before installation worked for me.

Installing only new packages from composer.json

I'm trying to make composer update only newly added packages to composer.json i.e when I manually add a package dependency to the composer.json file, it should update the composer.lock file only for the new package; the rest of the packages should be at the same version as before. I tried running composer update --lock but I don't think it does what I'm trying to achieve and it took a lot of time to finish. I checked the commands on composer's documentation but can't find one to achieve my wish. Any advice or workaround will be appreciated.
Note: I'm using Laravel Forge, so there is a 2 minutes deployment limit.
In order to install only new packages with composer you should run
composer install
Because composer update will install your new packages but will update and all the other already installed packages.
You can specify the name of the package as an argument to the update command. This will perform a partial update: composer update the-package/you-want-to-update
I think your question is related to your (guessed) current workflow: To add a new package you edit the composer.json file and then run composer update - wishing to only add/update that new file.
If that is true, here is the solution:
composer require new/package will add the newest possible version (taking into account the currently installed packages) of the new package. Benefits: Only one command line, and no fiddling with JSON content.
If you already know which version you want, you could also run composer require new/package:^2.1.25#beta (or whatever version and stability level you want - this example is exaggerating a bit). If this version is incompatible with existing packages, nothing will get installed, everything will get rolled back, and you get an error message.

Cannot update project with composer

I pushed my package medyes/ebay-api on github.
When I tried to download it on another project with composer I have an error:
Command composer:
composer require medyes/ebay-api:dev-master
The error:
[InvalidArgumentException]
Could not find package medyes/ebay-api at any version for your
minimum-stability (dev). Check the package spelling or your minimum
-stability
this is the composer.json of medyes/ebay-api package
composer.json
Avoid using branches - especially when the project you are about to include offers tagged versions.
composer require medyes/ebay-api:~0.1
This will update this package until version 1.0 comes out (which would not be installed, because that major release number change it is considered incompatible according to semantic versioning) every time a newer, installable version exists and you run composer update.

Resources