Satis circular dependencies - php

I have a project with multiple packages
Each package is in a private git repository.
Some of the packages have dependencies of each other.
You can check here how my satis http://codepen.io/anon/pen/wBOEQW page looks like.
Now if I clone the project-xpto/core, and run a composer update i get this:
➜ php-core git:(master) 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
- Installation request for project-xpto/event dev-master -> satisfiable by project-xpto/event[dev-master].
- project-xpto/event dev-master requires project-xpto/activity-streams dev-master -> no matching package found.
Problem 2
- Installation request for project-xpto/tool dev-master -> satisfiable by project-xpto/tool[dev-master].
- project-xpto/tool dev-master requires project-xpto/activity-streams dev-master -> no matching package found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-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.
satis.json => http://pastie.org/private/s0e2rxtnvpv9g7rpp415a
composer.json xpto-core => http://pastie.org/10062586
composer.json xpto-event => http://pastie.org/private/stxe2sbwpja8088knrldq
composer.json xpto-tool =>
http://pastie.org/private/11o9wv94kvfprl5wjfibrq
composer.json
xpto-activity-streams =>
http://pastie.org/private/plieipe2gco1yt4gs0jxg
Isn't suppose to satis resolve all dependencies and all work fine?
What i'm doing wrong?
If you need anything else, just ask i will update here.

Please give this a try:
add "minimum-stability": "dev" to the composer.json of project-xpto/core.
You require a lot of dev-master stability packages, but the default minimum-stability is stable. So they are not resolved to a stable set. You need to lower stability for all packages to dev by setting the above directive in your main projects composer.json.
Alternatively you could use dev-master#dev to lower stability on a specific package. But here it's quite a number of packages, so i would suggest to set minimum-stability dev for the whole project.
You can combine "minimum-stability dev" with "prefer-stable true".
This tells Composer to resolve to stable versions AND ONLY if stable could not be resolved, use a dev dependency. This setting is a good way in the starting phase of a private project, where packages start to grow out of "dev-master" and into "stable versions".
"minimum-stability": "dev",
"prefer-stable" : true

Related

Failed while installing a package using composer

iam tryin to use a cart package by using this command
composer require jason-napolitano/codeigniter4-cart-module
and it's failed. this is what it said
Using version dev-master for jason-napolitano/codeigniter4-cart-module
./composer.json has been updated
Running composer update jason-napolitano/codeigniter4-cart-module
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires jason-napolitano/codeigniter4-cart-module dev-master -> satisfiable by jason-napolitano/codeigniter4-cart-module[dev-master].
- jason-napolitano/codeigniter4-cart-module dev-master requires codeigniter4/framework ^4.0.3 -> satisfiable by codeigniter4/framework[v4.0.3, ..., v4.1.1] from composer repo (https://repo.packagist.org) but codeigniter4/framework[1.0.0+no-version-set] from root package repo has higher repository priority. The
packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
is it because my minimum-stability in composer.json is set to "stable"?
I presume you created your project by using composer create-project codeigniter4/framework. This effectively created a clean project for you without the .git folder, thus removing any metadata on what version of codeigniter4/framework package you installed. This is indicative by 1.0.0+no-version-set part of the error message.
The jason-napolitano/codeigniter4-cart-module package requires ^4.0.3 version of codeigniter4/framework, but since you have no version metadata in your project, install fails. This can be resolved by setting the version from which you bootstrapped your project manually in your root composer.json:
{
"name": "codeigniter4/framework",
"version": "4.0.3",
...
}
However, this is just a guess, since I have no insight into your main composer.json.
Your PHP is missing intl extension. It is useful for formatting currency, number and date/time as well as UCA-conformant collations, for message formatting and normalizing text..etc.
Check out Codeignitor 4 [Documentation][1]:
Follow the steps to install it in XAMPP -
Open [xampp_folder_path]/php/php.ini to edit.
Search for ;extension=intl and remove the ;.
Save the php.ini file and restart Apache.

The requested package exists but these are rejected by your constraint

I want to add this tag from the branch 1.x to my project.
I specified: "monolog/monolog": "dev-1.x#1.23.0"
And ran composer update monolog/monolog
Composer says:
Problem 1
- The requested package monolog/monolog dev-1.x#1.23.0 exists as monolog/monolog[1.0.0, 1.0.0-RC1, 1.0.1, 1.0.2, 1.1.0, 1.10.0, 1.11.0, 1.12.0, 1.13.0, 1.13.1, 1.14.0, 1.15.0, 1.16.0, 1.17.0, 1.17.1, 1.17.2, 1.18.0, 1.18.1, 1.18.2, 1.19.0, 1.2.0, 1.2.1, 1.20.0, 1.21.0, 1.22.0, 1.22.1, 1.23.0, 1.3.0, 1.3.1, 1.4.0, 1.4.1, 1.5.0, 1.6.0, 1.7.0, 1.8.0, 1.9.0, 1.9.1, 1.x-dev, dev-master, 2.x-dev] but these are rejected by your constraint.
I want to pull specific tag from specific branch. What do I do? this answer suggests I should be ok.
UPDATE:
After following Loek's advise and removing everything before the actual tag I get this:
The requested package monolog/monolog (installed at 1.21.0, required as 1.23.0) is satisfiable by monolog/monolog[1.21.0] but these conflict with your requirements or minimum-stability.
I already have "minimum-stability": "dev" set up.
You can use the composer why-not command to see what packages are conflicting with the version you've specified.
So, without any changes to your composer.json, run:
composer why-not monolog/monolog 1.23.0
This should tell you where the conflict is occurring.
There are also some things you can do to make such conflicts less likely:
Be less strict in your version constraints. Pegging to a specific version of a package gives Composer less freedom to find a working set of packages.
Edit your constraints, and then run composer update without any arguments, to let Composer find the best set of packages that meets those constraints, rather than forcing it to change one package at a time.
I have had the same issue and the problem was on Packagist, I updated the release on Github and it was not updated on Packagist yet. So after updating it there the problem got fixed.
You can just specify the tag you want to download. If the package maintainers tagged their versions well, it doesn't matter on what branch or what stability it is. If you specify 1.23.0, it will always pull in 1.23.0.
EDIT
There is probably some package colliding. Check #IMSoP's answer for an easier way to resolve than mine.
Mine would be: update all the packages and Composer should show what packages are colliding.
I had a similar issue with phpmyadmin after some time keeping intact. version 4.5.0 which I realized was not existing, either deleted or wrongly inputted in past
What seems to help me was manually editing - removing the record from composer.json and issuing composer install command.
The next step was installing one of the concreted versions which was already mentioned like problematic - rejected by constrains 4.7.0 - php7.0 composer install phpmyadmin/phpmyadmin:4.7.0
I had also added along two settings - but those didn't seem to work alone
"minimum-stability": "dev",
"prefer-stable": true,
My original error message was
Problem 1
- The requested package phpmyadmin/phpmyadmin 4.5.0.* exists as phpmyadmin/phpmyadmin[4.0.0, 4.0.1, 4.0.10, 4.0.10.1, 4.0.10.2, 4.0.10.3, 4.0.10.4, 4.0.10.5, 4.0.10.6, 4.0.10.7, 4.0.10.8, 4.0.10.9, 4.0.2, 4.0.3, 4.0.4, 4.0.4.1, 4.0.4.2, 4.0.5, 4.0.6, 4.0.7, 4.0.8, 4.0.9, 4.7.0, 4.7.1, 4.7.2, 4.7.3, 4.7.4, 4.7.5, 4.7.6, 4.7.7, 4.7.8, 4.7.9, 4.7.x-dev, 4.8.0, 4.8.0.1, 4.8.1, 4.8.2, 4.8.3, 4.8.4, 4.8.5, 4.8.x-dev, 4.9.0, 4.9.0.1, 4.9.1, 4.9.x-dev, 5.0.x-dev, dev-master, 5.1.x-dev] but these are rejected by your constraint.

Composer can't install own packagist package, minimum-stability error

I have own package at github I created tag with name: "1.0.0".
composer.json in this tag don not have "minimum-stability" property (I tried with "minimum-stability": "dev" and "minimum-stability": "stable") but same error appears.
Error that I get is:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package am2studio/laravel-table-sorter 1.* could not be found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
I am trying to install package with
"comp-x/package-x": "1.*"
in composer and this error appears, with:
"comp-x/package-x": "dev-master"
everything is fine, and composer installs my package. Do you know what is problem here ?

Failing to get package via composer require

I want to user this package hslavich/simplesamlphp-bundle in my project which has dependency on simplesamlphp/simplesamlphp dev-master
If I try to add dependency like this:
composer require hslavich/simplesamlphp-bundle dev-master
I get the following error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for hslavich/simplesamlphp-bundle dev-master -> satisfiable by hslavich/simplesamlphp-bundle[dev-master].
- hslavich/simplesamlphp-bundle dev-master requires simplesamlphp/simplesamlphp dev-master -> no matching package found.
If I git clone the hslavich/SimplesamlphpBundle and use composer update simplesamlphp package is downloaded successfully.
What am I doing wrong?
Add "minimum-stability": "dev" to composer.json. The usage of dev package versions imples that you need to have it. Use
"minimum-stability": "dev",
"prefer-stable" : true
if you don't want it to affect other packages without strict version constraints.

Composer dependancy not available for PHPDOX

I am trying to install phpdox through composer.
"require": {
"phploc/phploc": "2.0.6",
"phpunit/phpunit": "4.2.4",
"pdepend/pdepend": "2.0.0",
"phpmd/phpmd": "2.0.0",
"squizlabs/php_codesniffer": "2.0.0a2",
"sebastian/phpcpd": "2.0.*#dev",
"theseer/phpdox": "0.6.6.1"
}
Which produces the following:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
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
- Installation request for theseer/phpdox 0.6.6.1 -> satisfiable by theseer/phpdox[0.6.6.1].
- theseer/phpdox 0.6.6.1 requires nikic/php-parser >=1.0.0 -> no matching package found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
However, on the packagist website it says that phpdox has a dependency nikic/php-parser: >=1.0.0 which does not exist.
How do I resolve that?
The package nikic/php-parser has only been tagged as a beta version 1.0, not a stable release.
theseer/phpdox does require that 1.0.0 version, however it has set minimum-stability:dev and prefer-stable:true in it's own composer.json. These settings can only be defined in the root composer.json.
Two ways to fix it:
Require the needed beta version of that package yourself: composer require nikic/php-parser:~1.0#beta would do it.
Also set the settings for minimum stability to at least "beta" and add the prefer-stable flag to avoid getting ALL packages in beta stability.
Reading the installation instructions I get the idea that you are not supposed to require this tool directly via Composer. I can't see a reason why not to do it, but this probably hasn't been anticipated. So optional step 3: Open a ticket on Github to get this issue fixed.

Categories