Composer package issue - composer-php

I work on a project that uses composer for dependency management:
{
"require": {
"doctrine/annotations": "1.8.0",
"doctrine/dbal": "2.9.3",
"doctrine/orm": "2.7.1",
"doctrine/reflection": "1.2.0",
"giggsey/libphonenumber-for-php": "8.11.5",
"guzzlehttp/guzzle": "6.5.2",
"james-heinrich/getid3": "v1.9.19",
"php-extended/php-http-message-factory-psr17": "2.0.0",
"phpoffice/phpspreadsheet": "1.10.1",
"psr/event-dispatcher": "1.0.0",
"sabre/vobject": "4.2.2",
"sabre/xml": "2.1.3",
"spiral/roadrunner": "1.7.0",
"symfony/browser-kit": "4.4.4",
"symfony/cache": "v4.4.4",
"symfony/class-loader": "v3.4.38",
"symfony/config": "4.4.4",
"symfony/console": "4.4.4",
"symfony/css-selector": "4.4.4",
"symfony/debug": "4.4.4",
"symfony/dependency-injection": "4.4.4",
"symfony/dom-crawler": "4.4.4",
"symfony/error-handler": "4.4.4",
"symfony/event-dispatcher": "v4.4.4",
"symfony/expression-language": "4.4.4",
"symfony/filesystem": "4.4.4",
"symfony/finder": "4.4.4",
"symfony/http-foundation": "4.4.4",
"symfony/http-kernel": "4.4.4",
"symfony/mailer": "4.4.4",
"symfony/mime": "4.4.4",
"symfony/polyfill-ctype": "1.14.0",
"symfony/polyfill-intl-idn": "1.14.0",
"symfony/polyfill-mbstring": "1.14.0",
"symfony/polyfill-php72": "1.14.0",
"symfony/polyfill-php73": "1.14.0",
"symfony/process": "4.4.4",
"symfony/service-contracts": "2.0.1",
"symfony/validator": "4.4.4",
"symfony/var-dumper": "4.4.4",
"symfony/var-exporter": "4.4.4",
"symfony/yaml": "4.4.4"
}
}
I'm trying to add a new dependency to the project, namely symfony/contracts. This package replaces several other Symfony packages, among other the symfony/event-dispatcher-contracts package, which is indirectly required as a dependency in the project.
However, when running the composer require symfony/contracts command, I get an error message that I cannot figure out:
# composer require symfony/contracts:2.0.1
./composer.json has been updated
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
- don't install symfony/event-dispatcher-contracts v1.1.7|don't install symfony/contracts v2.0.1
- don't install symfony/contracts v2.0.1|remove symfony/event-dispatcher-contracts v1.1.7
- don't install symfony/contracts v2.0.1|don't install symfony/event-dispatcher-contracts v1.1.7
- Installation request for symfony/contracts 2.0.1 -> satisfiable by symfony/contracts[v2.0.1].
- Installation request for symfony/event-dispatcher-contracts (locked at v1.1.7) -> satisfiable by symfony/event-dispatcher-contracts[v1.1.7].
Installation failed, reverting ./composer.json to its original content.
I have tried removing everything except composer.json and doing a reinstall, but ended up with the same error.
Another puzzling issue was that the symfony/event-dispatcher-contracts package is not explicitly locked in composer.json to a certain version, yet the error message specifies the v1.1.7 version, instead of the latest one, which is 2.0.1 as of this time. Looking into the composer.lock file, I see that there is a single require directive which includes this package, defined as symfony/event-dispatcher requires "symfony/event-dispatcher-contracts": "^1.1". This indeed forces the symfony/event-dispatcher-contracts to version 1.1.7, but I can't explain why it forces the package to be installed, instead of replacing it with symfony/contracts.
How can I add symfony/contracts to this project and remove the symfony/event-dispatcher-contracts dependecy (which is included in the symfony/contracts package).

symfony/contracts replaces symfony/event-dispatcher-contracts and other packages. Check which of your other packages requires this package through composer why symfony/event-dispatcher-contracts - I would assume that you need to update any of your other packages before you can start using the unified contracts package.
In your current setup, symfony/event-dispatcher requires the specific contracts in v1.1. The package to be installed replaces these contracts, but only those from v2. Installing symfony/contracts with the version constraint ^1.1 might be the best solution, if you don't want to upgrade symfony/event-dispatcher to v5 - this relies on v2 of the contracts

Related

Problem with laravel/ui while installing laravel-dompdf laravel8

Can someone help me to fix it?
while installing
composer require barryvdh/laravel-dompdf
Errors
Problem 1
- laravel/ui is locked to version v2.3.0 and an update of this package was not requested.
Problem 2
- nette/schema v1.2.1 requires php >=7.1 <8.1 -> your php version (8.1.6) does not satisfy that requirement.
- league/commonmark 2.0.2 requires league/config ^1.1.1 -> satisfiable by league/config[v1.1.1].
- laravel/framework v8.61.0 requires league/commonmark ^1.3|^2.0 -> satisfiable by league/commonmark[2.0.2].
- league/config v1.1.1 requires nette/schema ^1.2 -> satisfiable by nette/schema[v1.2.1].
- laravel/framework is locked to version v8.61.0 and an update of this package was not requested.
composer.json
"require": {
....
"php": "^7.3|^8.0",
"laravel/framework": "^8.54",
"laravel/ui": "^2.0",
"laravelcollective/html": "^6.1",
"livewire/livewire": "^2.5",
"maatwebsite/excel": "^3.1",
....
},
composer require barryvdh/laravel-dompdf

Problem with installing a Laravel package using composer

I want to using a package in my project.
Composer.json:
"require": {
"php": "^7.2.5|^8.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^6.3.1|^7.0.1",
"hekmatinasser/verta": "^1.11",
"laravel/framework": "^7.29",
"laravel/passport": "^9.3",
"laravel/tinker": "^2.5",
"lcobucci/jwt": "3.3.3",
"pishran/zarinpal": "^2.2"
},
My target package to install :
composer require ipecompany/smsirlaravel
Problem : When I try this on composer, I see follwing error
Problem 1
- ipecompany/smsirlaravel[v1.0.0, ..., v1.0.7] require guzzlehttp/guzzle ~6.0 -> found guzzlehttp/guzzle[6.0.0, ..., 6.5.x-dev] but the package is fixed to 7.2
.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires ipecompany/smsirlaravel ^1.0 -> satisfiable by ipecompany/smsirlaravel[v1.0.0, ..., v1.0.7].
I tried :
composer require ipecompany/smsirlaravel -W
But the main problem is Laravel Passport maybe because of following error :
Problem 1
- laravel/passport is locked to version v9.3.2 and an update of this package was not requested.
- laravel/passport v9.3.2 requires laminas/laminas-diactoros ^2.2 -> found laminas/laminas-diactoros[2.2.0, ..., 2.6.x-dev] but it conflicts with another require.
I tried to install laminas/laminas-diactoros ^2.2 but I got another error
problem 1
- Root composer.json requires laminas/laminas-diactoros 2.2, found laminas/laminas-diactoros[2.2.0] but it conflicts with another require.
Problem 2
- laravel/passport is locked to version v9.3.2 and an update of this package was not requested.
- laravel/passport v9.3.2 requires laminas/laminas-diactoros ^2.2 -> found laminas/laminas-diactoros[2.2.0, ..., 2.6.x-dev] but it conflicts with another require.
Any body can help me to install this package? TNX
As written in the first error message: ipecompany/smsirlaravel requires v6 of Guzzle, but currently v7 is installed. You should use a different version constraint for Guzzle first: change "guzzlehttp/guzzle": "^6.3.1|^7.0.1" to "guzzlehttp/guzzle": "^6.3.1". Afterwards, run composer update guzzlehttp/guzzle such that Guzzle v6 is installed.
Afterwards, running composer require ipecompany/smsirlaravel should work

composer installation fails - jimmyjs/laravel-report-generator

Trying to install jimmyjs/laravel-report-generator
Command:
composer require jimmyjs/laravel-report-generator
Output:
vagrant#homestead:~/code/BEAM$ composer require jimmyjs/laravel-report-generator
Using version ^1.1 for jimmyjs/laravel-report-generator
./composer.json has been updated
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: maatwebsite/excel[2.1.x-dev, 3.1.11].
- Can only install one of: maatwebsite/excel[3.1.11, 2.1.x-dev].
- Can only install one of: maatwebsite/excel[2.1.x-dev, 3.1.11].
- jimmyjs/laravel-report-generator 1.1.0 requires maatwebsite/excel ~2.1.0
-> satisfiable by maatwebsite/excel[2.1.x-dev].
- Installation request for jimmyjs/laravel-report-generator ^1.1
-> satisfiable by jimmyjs/laravel-report-generator[1.1.0].
- Installation request for maatwebsite/excel (locked at 3.1.11, required as ^3.1)
-> satisfiable by maatwebsite/excel[3.1.11].
Installation failed, reverting ./composer.json to its original content.
I don't know if I'm misunderstanding the error? Says I can only have one maatwebsite (which is the case)?
composer.json current require which has maatwebsite (only instance) in it:
"require": {
"php": ">=7.1.3",
"barryvdh/laravel-snappy": "^0.4.4",
"fideloper/proxy": "^4.0",
"h4cc/wkhtmltoimage-amd64": "0.12.x",
"h4cc/wkhtmltopdf-amd64": "0.12.x",
"laravel/framework": "5.8.*",
"laravel/tinker": "^1.0",
"laravelcollective/html": "^5.6",
"maatwebsite/excel": "^3.1",
"spatie/laravel-permission": "^2.13"
},
if you need explicitly that version of Maatwebsite ("maatwebsite/excel": "^3.1",), then you cant fix it cause jimmyjs/laravel-report-generator is not up to date with the new version of maatwebsite.
if you dont need the version 3 of Maatwebsite, you can remove the requirement for it and jimmyjs/laravel-report-generator will require the version maatwebsite/excel 2.1.x-dev.
wich might have some issue with your current version of php (7.1).
Better look for another alternative to jimmyjs/laravel-report-generator that uses the V3 of maatwebsite or something else
Or even better, do it yourself instead of using jimmyjs/laravel-report-generator. Maatwebsite v3 is really easy to use
If you have looked it then your version is 3.1 "maatwebsite/excel": "^3.1",
Now check your error
Problem 1
- Can only install one of: maatwebsite/excel[2.1.x-dev, 3.1.11].
it says you need to install in "maatwebsite/excel": "^2.1"
Change and Add in your composer.json file:
"require": {
"jimmyjs/laravel-report-generator": "^1.1",
"maatwebsite/excel": "^2.1"
},
after, run this command in your command prompt composer update

Composer can not install dependencies

I have a FuelPhp project and i am trying to install dependencies via composer.
When i ran composer install on command line, i get following error;
The requested PHP extension ext-mbstring ^0.0.0 has the wrong version (7.0.18) installed. Install or enable PHP's mbstring extension.
I have mbstring extension installed and enabled. Why composer complaining about ext-mbstring extension ?
Composer Version:1.6.3
Php Version:7.0.18
OS:Windows 10
This is from composer.json
"require": {
"php": ">=5.3.3",
"composer/installers": "~1.0",
"fuel/docs": "dev-1.7/master",
"fuel/core": "dev-1.7/master",
"fuel/auth": "dev-1.7/master",
"fuel/email": "dev-1.7/master",
"fuel/oil": "dev-1.7/master",
"fuel/orm": "dev-1.7/master",
"fuel/parser": "dev-1.7/master",
"trait-orm-format": "dev-master",
"fuelphp/upload": "2.0.2",
"monolog/monolog": "1.5.*",
"michelf/php-markdown": "1.4.0",
"ext-mbstring": "^0.0.0"
}
^0.0.0 version constraint means Composer will not install anything beyond 0.0.* version.
Use "ext-mbstring": "*" as version constraint and install should pass correctly.

Why does Composer say "Conclusion: don't install" when (seemingly) no obstacles are present?

The following composer.json:
{
"type": "project",
"minimum-stability": "dev",
"require": {
"jasny/bootstrap": ">=3.1.3",
"2amigos/yii2-file-input-widget": "*"
}
}
leads to the following output of composer update:
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
- 2amigos/yii2-file-input-widget 0.1.2 requires jasny/bootstrap v3.1.0 -> satisfiable by jasny/bootstrap[v3.1.0] but these conflict with your requirements or minimum-stability.
- 2amigos/yii2-file-input-widget 0.1.1 requires jasny/bootstrap v3.1.0 -> satisfiable by jasny/bootstrap[v3.1.0] but these conflict with your requirements or minimum-stability.
- 2amigos/yii2-file-input-widget 0.1.0 requires jasny/bootstrap v3.1.0 -> satisfiable by jasny/bootstrap[v3.1.0] but these conflict with your requirements or minimum-stability.
- 2amigos/yii2-file-input-widget 1.0.0 requires jasny/bootstrap ~3.1.0 -> satisfiable by jasny/bootstrap[v3.1.3].
- 2amigos/yii2-file-input-widget 1.0.1 requires jasny/bootstrap ~3.1.0 -> satisfiable by jasny/bootstrap[v3.1.3].
- 2amigos/yii2-file-input-widget 1.0.2 requires jasny/bootstrap ~3.1.0 -> satisfiable by jasny/bootstrap[v3.1.3].
- 2amigos/yii2-file-input-widget dev-master requires jasny/bootstrap ~3.1.0 -> satisfiable by jasny/bootstrap[v3.1.3].
- 2amigos/yii2-file-input-widget 1.0.x-dev requires jasny/bootstrap ~3.1.0 -> satisfiable by jasny/bootstrap[v3.1.3].
- Conclusion: don't install jasny/bootstrap v3.1.3
- Installation request for 2amigos/yii2-file-input-widget * -> satisfiable by 2amigos/yii2-file-input-widget[0.1.0, 0.1.1, 0.1.2, 1.0.0, 1.0.1, 1.0.2, dev-master, 1.0.x-dev].
Why?
Ok, I understand, why versions 0.1.0–0.1.2 of 2amigos/yii2-file-input-widget can't be installed — because they require jasny/bootstrap of exact version 3.1.0, which conflicts with >=3.1.3 requirement in composer.json (and therefore composer clarifies: but these conflict with your requirements or minimum-stability).
But, from common-sense view, composer can install version 1.0.0 or later of 2amigos/yii2-file-input-widget (which requires jasny/bootstrap of version ~3.1.0, which is satisfiable by 3.1.3). Neither I see any obstacles for installing 2amigos/yii2-file-input-widget 1.0.0+ together with jasny/bootstrap 3.1.3, nor composer writes any explicit clarification about it. Still it says: Conclusion: don't install jasny/bootstrap v3.1.3 — why?
Workaround 1
It seems it works with "prefer-stable": true.
Workaround 2
I actually found the other workaround some time ago: I replace "2amigos/yii2-file-input-widget": "*" with "2amigos/yii2-file-input-widget": "1.0.2", do composer update and then replace it back and do composer update again — and it works.
The question is why it works in so strange way: why it works with more restrictions, but fails with less restrictions (with no clarification). E.g. if it works with 1.0.2 (or with prefer-stable) works — then why it doesn't with * (or without prefer-stable)?
Change the order and it should work, e.g.
{
"minimum-stability": "dev",
"require": {
"2amigos/yii2-file-input-widget": "*",
"jasny/bootstrap": ">=3.1.3"
}
}
Why? I don't know. Most likely a Composer's bug.
I've tested two configurations with different order on the empty folder using composer install command (Composer v1.6.3), the original order fails, however the order above works. I've reported the issue at GH-7215.
The problem might well be that you are manually editing composer.json and then running
$ composer update
Instead, revert the changes to composer.json and then run:
$ composer require jasny/bootstrap:>=3.1.3
$ composer require "2amigos/yii2-file-input-widget:*"
or in one go:
$ composer require jasny/bootstrap:>=3.1.3 "2amigos/yii2-file-input-widget:*"
Note I recommend to avoid the * wildcard as version constraint because it could pull in any version of that dependency, and potentially break your application by pulling in a version that is not compatible with it.
For reference, see:
http://semver.org

Resources