Composer update probleme on cpanel for symfony - symfony

I have a problem for a symfony app when I try to install dependencies with composer :
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/framework-bundle[v6.0.0, ..., v6.0.12] require composer-runtime-api >=2.1 -> found composer-runtime-api[2.0.0] but it does not match the constraint.
- Root composer.json requires symfony/framework-bundle 6.0.* -> satisfiable by symfony/framework-bundle[v6.0.0, ..., v6.0.12].
Composer version I have on cpanel : 2.0.8
I didn't upgrade composer to the last version.

symfony/framework-bundle[v6.0.0, ..., v6.0.12] require composer-runtime-api >=2.1 -> found composer-runtime-api[2.0.0] but it does not match the constraint.
That line basically tells you that Symfony in v6 requires any Composer version equal or above 2.1, and you are currently using Composer v2.0. Please update Composer itself, for example by using composer self-update

Related

composer install -n --ignore-platform-reqs not ignoring PHP extension

we have circle build that runs composer install -n --ignore-platform-reqs --no-dev but this is not ignoring the platform requirements anymore.
This is what i see in the circle log. The --ignore-platform-reqs is clearly not working. Any ideas why please?
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for drupal/core 8.6.13 -> satisfiable by drupal/core[8.6.13].
- drupal/core 8.6.13 requires ext-pdo * -> the requested PHP extension pdo is missing from your system.
Problem 2
- typo3/phar-stream-wrapper v2.1.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
- typo3/phar-stream-wrapper v2.1.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
- Installation request for typo3/phar-stream-wrapper v2.1.0 -> satisfiable by typo3/phar-stream-wrapper[v2.1.0].
Instead of using --ignore-platform-reqs or provide hack it is better to mimic your environment using platform setting - it gives you more control about platform requirements and it is more intuitive than provide (your package does not really provide ext-fileinfo):
"config": {
"platform": {
"php": "7.2.14",
"ext-fileinfo": "1.0.5",
"ext-pdo": "7.2.14",
"ext-session": "7.2.14",
"ext-iconv": "7.2.14",
"ext-zip": "1.15.4"
}
},
Actual versions of extensions you may find by calling this command on production environment (although you could probably put anything for extensions version - it is quite uncommon to use anything except * as a constraint for PHP extensions):
composer show -p
I am going to answer my own question just in case somebody stumbles here. Adding a provide with the list of extension in my composer.json file resolved the issue for me. This --ignore-platform-reqs had no effect.
"provide": {
"ext-fileinfo": "*",
"ext-pdo": "*",
"ext-session": "*",
"ext-iconv": "*",
"ext-zip": "*"
}

Can not update google/cloud-firestore [composer]

Now, I am using google/cloud-firestore ^0.8.1 and I want to update this library to latest version (0.14.0).
My composer.json now looks like:
"require": {
"grpc/grpc": "^1.10",
"google/protobuf": "^3.5",
"google/gax": "^0.31.3",
"google/cloud-firestore": "^0.8.1",
"firebase/php-jwt": "^5.0",
}
When I try to update firestore library with php composer.phar require google/cloud-firestore
, I got:
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for google/cloud-firestore ^0.14.0 -> satisfiable by google/cloud-firestore[v0.14.0].
- google/cloud-firestore v0.14.0 requires google/gax ^0.37 -> satisfiable by google/gax[0.37.0] but these conflict with your requirements or minimum-stability.
Installation failed, reverting ./composer.json to its original content.
After that, I tried with php composer.phar require google/gax and got:
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- google/cloud-firestore v0.8.1 requires google/gax ^0.31.1 -> satisfiable by google/gax[0.31.x-dev].
- google/cloud-firestore v0.8.1 requires google/gax ^0.31.1 -> satisfiable by google/gax[0.31.x-dev].
- google/cloud-firestore v0.8.1 requires google/gax ^0.31.1 -> satisfiable by google/gax[0.31.x-dev].
- Can only install one of: google/gax[0.37.0, 0.31.x-dev].
- Installation request for google/gax ^0.37 -> satisfiable by google/gax[0.37.0].
- Installation request for google/cloud-firestore ^0.8.1 -> satisfiable by google/cloud-firestore[v0.8.1].
Installation failed, reverting ./composer.json to its original content.
I added "minimum-stability": "dev" to composer.json but that didn't resolve problem.
How to properly update these libraries and fix dependencies between them?
The semantic versioning operator (^) behaves slightly different with pre-1.0 releases (see https://getcomposer.org/doc/articles/versions.md#caret-version-range-):
For pre-1.0 versions it also acts with safety in mind and treats ^0.3 as ?>=0.3.0 <0.4.0.
This means that you will have to update both packages like this:
composer require google/cloud-firestore:^0.14 google/gax:^0.37
With #xabbuh help, I find out solution.
There wasn't problem just in semantic versioning operator (^) but in packages I wanted to update.
I needed to install/update all packages that are needed for updating firestore on version 0.14. I called composer require google/cloud-firestore:^0.14 and after that composer require google/gax:^0.37 and after that tried with reverse order, but there were similar error messages.
When I included all packages needed into require command for updating firestore package it passed well.
So, here are working command:
composer require google/cloud-firestore:^0.14 google/gax:^0.37 google/auth:^1.3 google/grpc-gcp:^0.1.0 grpc/grpc:^1.13.0 google/cloud-core:^1.23

Unable to update dompdf via Composer in Drupal 8

We are in the midst of trying to get all of our Drupal modules that were not installed using Composer to be managed within Composer.
Composer: 1.4.12
Drupal: 8.3.1
After clearing Composer's cache, we ran the following:
./composer require dompdf/dompdf;
This returns:
./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Can only install one of: phenx/php-svg-lib[v0.2, 0.1].
- Can only install one of: phenx/php-svg-lib[v0.2, 0.1].
- Can only install one of: phenx/php-svg-lib[v0.2, 0.1].
- dompdf/dompdf v0.8.0 requires phenx/php-svg-lib 0.2.* -> satisfiable by phenx/php-svg-lib[v0.2].
- Installation request for dompdf/dompdf ^0.8.0 -> satisfiable by dompdf/dompdf[v0.8.0].
- Installation request for phenx/php-svg-lib (locked at 0.1) -> satisfiable by phenx/php-svg-lib[0.1].
Installation failed, reverting ./composer.json to its original content.
It seems like the proper thing to do would be to not lock "phenx/php-svg-lib" to version 0.1, then upgrade dompdf, however when we modified dompdf's composer.json file to require phenx/php-svg-lib version 0.2.*, clearcache, then try require again, we get the same error as above, which still references the lock at 0.1. I've also confirmed that dompdf is the only vendor module that is using phenx/php-svg-lib.
Also, is there a reason why "Can only install one of" is listed three times?
Thank you in advance for any advice.
It appears like this problem happens when updating dompdf from version 0.7.0 to 0.8.0. For some reason, the update works perfectly fine with composer 1.2.x, but does result with the above error with version 1.4.x.
The fix that did the job for me was to remove
"dompdf/dompdf": "^0.7.0"
from the composer.json file and then run:
composer update
The result should be something like:
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 0 updates, 3 removals
- Removing dompdf/dompdf (v0.7.0)
- Removing phenx/php-font-lib (0.4)
- Removing phenx/php-svg-lib (0.1)
Writing lock file
Generating autoload files
Then require a new version:
composer require dompdf/dompdf

FOSRestBundle & JMSSerializerBundle with symfony 2.7 and PHP 5.5.12

I'd like to add the 2 libraries FOSRestBundle & JMSSerializerBundle to my application built with symfony 2.7 but i encountred this response
Problem 1
- Installation request for friendsofsymfony/rest-bundle dev-master -> satisfiable by friendsofsymfony/rest-bundle[dev-master].
- friendsofsymfony/rest-bundle dev-master requires php ^5.5.9|~7.0 -> your PHP version (5.5.12) overriden by "config.platform.php" version (5.3.9) does not satisfy that requirement.
Problem 2
- Installation request for jms/serializer-bundle dev-master -> satisfiable by jms/serializer-bundle[dev-master].
- jms/serializer-bundle dev-master requires php >=5.4.0 -> your PHP version (5.5.12) overriden by "config.platform.php" version (5.3.9) does not satisfy that requirement.
Notice that PHP version is 5.5.12
I think the problem is the version of this 2 libraries. If yes, What are the versions of FOSRestBundle & JMSSerializerBundle ?
dev-master should never be used as version bound when requiring a package as dependency, except in some specific cases.
Go to https://packagist.org/ then search for the packages you are looking for and use their respective current stable version as version bound for your composer.json's requirement.
Also, in your composer.json, you have a config key containing a platform.php key with 5.3.9 as value. Remove or override this block according to your real PHP version. See Symfony2, composer, your PHP version (5.6.18) overriden by "config.platform.php" version (5.3.9) does not satisfy requirement.
Of course, if the last stable version of one of them isn't compatible with your environment (PHP >= 5.5.9 for friendsofsymfony/rest-bundle), you need to look for an older version supporting your environment (all is available on packagist, and surely on the official documentation of these packages).

Installing EWZRecaptchaBundle in Symfony2

I'm using symfony 2.4.0, and I want to install the EWZRecaptchaBundle to add a captcha to my forms, so I added this line to composer.json
"require": {
//...
"excelwebzone/recaptcha-bundle": "2.0.*"
//...
}
And I run this command
composer update
But it doesn't install the bundle successfully, and this is the error message I get, in the command
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package excelwebzone/recaptcha-bundle could not be found in
any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your min
imum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common
problems.
For the record, this is the Github link to the bundle I want to install :
https://github.com/excelwebzone/EWZRecaptchaBundle
Any idea??
Notes:
I use the command line as an Administrator.
I tested also with this line : ""excelwebzone/recaptcha-bundle": "dev-master"
The same result when I set minimum stability setting to : "dev" or "stable"
Try to use this require:
"excelwebzone/recaptcha-bundle": "dev-master"
Because 2.0.x-dev are in development now. or use old stable version:
"excelwebzone/recaptcha-bundle": "v1.0.0"
Victor you are completely right. However some might still encounter issues with the versioning.
You will still have an issue unless you use the exact 1.0 version.
So after doing the require:
composer require "excelwebzone/recaptcha-bundle"
you will have do add the version 1.0 like:
Please provide a version constraint for the excelwebzone/recaptcha-bundle requirement: 1.0.*

Resources