I am developing an add-on (atk4/audit) for a framework (atk4/data). My basic composer.json looks like this:
{
"type": "library",
"name": "atk4/audit",
"require": {
"atk4/data": "^1.3",
"php": ">=5.6.0"
}
}
This works fine and if composer require atk4/audit is used, then atk4/audit[1.0] and atk4/data[1.3] is installed.
However when attempted to use development branches:
{
"require": {
"atk4/data": "dev-develop",
"myaddon/addon": "dev-develop"
}
}
composer responds with error:
Problem 1
- Installation request for atk4/data dev-develop -> satisfiable by atk4/data[dev-develop].
- atk4/data dev-develop requires atk4/dsql dev-develop -> satisfiable by atk4/dsql[dev-develop] but these conflict with your requirements or minimum-stability.
Problem 2
- Installation request for atk4/audit dev-develop -> satisfiable by atk4/audit[dev-develop].
- atk4/audit dev-develop requires atk4/schema dev-develop -> satisfiable by atk4/schema[dev-develop] but these conflict with your requirements or minimum-stability.
I want my library to be usable in both "stable" and "dev-develop" versions. I have tried setting composer.json like this for the library:
{
"type": "library",
"name": "atk4/audit",
"require": {
"atk4/data": "dev-develop,^1.3",
"php": ">=5.6.0"
}
}
but, this does not work. I haven't found any mentions of this issue anywhere, I wonder if I'm on the wrong path?
When defining an unstable dependency with Composer, you need to specify the minimum stability.
{
"require": {
"atk4/data": "dev-develop",
"myaddon/addon": "dev-develop"
},
"minimum-stability": "dev"
}
You should also add "prefer-stable": true, otherwise all non-versionned packages in composer.json will be updated to the unstable branch.
Related
I created a package and have put it on a private Packagist which fetches from private Bitbucket repo. This all works fine until I try install the package. My composer.json looks like this:
{
"name": "XXXX/fields",
"description": "Field processor for easy saving and updating",
"type": "library",
"autoload": {
"psr-4": {
"XXXX\\Fields\\": "src/"
}
},
"authors": [
{
"name": "This Nerd",
"email": "This.Nerd#XXXX.nl"
}
],
"require": {},
"extra": {
"laravel": {
"providers": [
"XXXX\\Field\\FieldServiceProvider"
],
"aliases": {
"Field": "XXXX\\Field\\Facades\\Initiators\\Field"
}
}
}
}
When installing composer finds conflict with other packages:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- psr/cache 3.0.0 requires php >=8.0.0 -> your php version (7.4.19) does not satisfy that requirement.
- zircote/swagger-php 3.2.3 requires doctrine/annotations ^1.7 -> satisfiable by doctrine/annotations[1.13.1].
- darkaonline/l5-swagger 8.0.7 requires zircote/swagger-php 3.* -> satisfiable by zircote/swagger-php[3.2.3].
- doctrine/annotations 1.13.1 requires psr/cache ^1 || ^2 || ^3 -> satisfiable by psr/cache[3.0.0].
- darkaonline/l5-swagger is locked to version 8.0.7 and an update of this package was not requested.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
As you can see I'm not requiring any packages yet and have no requirements defined in my composer.json. The current version tag in the packagist is 1.0.1. When fetching composer tries "Using version ^1.0". So this all seems fine, but it isn't.
Any suggestions are welcome.
As nice_dev stated, the composer error was exclusively a php version error. This was due to me running it on the command line, where i run 7.4. However, I'm running sail and sail runs 8.0. So I needed to run it in sail. The reason I ran it local was because I had no ssh key on the sail server. In the end I solved this by adding a oauth key to the composer config
I have two Symfony projects: project-a (root project) and project-b.
My composer.json file from project-a contains:
{
"name": "myprojects/project-a",
"require": {
"myprojects/project-b": "dev-master",
},
"repositories": [
{
"type": "vcs",
"url": "git#bitbucket.org:MYPROJECTS/project-b.git"
}
]
}
And my composer.json from project-b:
{
"name": "myprojects/project-b",
"require": {
"guzzlehttp/guzzle": "^6.3"
}
}
I need to update project-b but when I execute the command composer update myprojects/project-b from project-a, I get this composer error:
[Composer\DependencyResolver\SolverProblemsException]
Problem 1
Installation request for myprojects/project-b dev-master -> satisfiable by
myprojects/project-b[dev-master].
myprojects/project-b dev-master requires guzzlehttp/guzzle ^6.3 -> 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
I have tried solve this adding "minimum-stability": "dev" property to both composer.json files, but it doesn't works.. How can I solve this?
Thanks.
As commented in guzzle/guzzle issue 861:
Looks like an issue with your caching.
Try clearing your composer cache, and self-update composer, then try again.
The OP Wildchild confirms in the comments:
composer clear cache and self-update solves my problem
"minimum-stability": "dev" is not needed.
I started working with PHPUnit a few days ago and came across this issue.
I want to test some classes in a project i cloned from github.
in the project there are two folders: "tests" and "src" and in each one of them composer.json file.
in the src folder the file looks like this:
{
"require": {
"php": ">=5.3.0",
"monolog/monolog": "1.*",
"slim/slim": "2.*"
},
"autoload": {
"classmap": ["classes/"]
}
}
and in the tests folder the file looks like this:
{
"require-dev": {
"phpunit/phpunit": "dev-master"
},
"autoload": {
"psr-0": {
"adServerTesting": ""
}
}
}
so i created this one united composer.json :
{
"require": {
"php": ">=5.3.0",
"monolog/monolog": "1.*",
"slim/slim": "2.*"
},
"require-dev": {
"phpunit/phpunit": "dev-master"
},
"autoload": {
"classmap": ["classes/"],
"psr-0": {
"adServerTesting": ""
}
}
}
but when i run composer install i get the following error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for phpunit/phpunit dev-master -> satisfiable by phpunit/phpunit[dev-master].
- phpunit/phpunit dev-master requires php >=5.6 -> your PHP version (5.5.9-1ubuntu4.11) does not satisfy that requirement.
since i have phpunit installed on my machine i tried to run the composer install from inside the src folder path and great, command and tests executed properly but now after uniting the files i get this error. I see it says i have php 5.5.9 which i need to upgrade but than why did it work when i run the composer install from the src folder?? thx..
phpunit/phpunit:#dev reuqires PHP 5.6 and your PHP version is 5.5.
Use lower version of PHPUnit, or rather let composer decide that. You can do that by calling:
composer require phpunit/phpunit --dev
--dev option for adding to require-dev section.
This question already has answers here:
but these conflict with your requirements or minimum-stability
(6 answers)
Closed 1 year ago.
I have created a composer package with this composer.json
{
"name": "webiny/cache",
"type": "library",
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"jamm/memory": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "4.1.*"
},
"autoload": {
"psr-4": {
"Webiny\\Component\\Cache\\": ""
}
},
"extras": {
"branches": {
"dev-master": "~0.9"
}
}
}
I'm having a problem with resolving jamm/memory package when I do a composer install on this file:
{
"require": {
"webiny/cache": "dev-master"
}
}
The error I get is
Problem 1
- Installation request for webiny/cache dev-master -> satisfiable by webiny/cache[dev-master].
- webiny/cache dev-master requires jamm/memory dev-master -> no matching package found.
When I just try to install the jamm/memory if works fine:
{
"require": {
"jamm/memory": "dev-master"
}
}
I have the minimum-stability flag set to dev in webiny\cache. I have also tried setting the release to #dev on jamm/memory dependency...didn't help.
I can't figure out what I'm doing wrong.
Solved it....
I added the minimum-stability flag to the composer.json file that I used to install the libraries...not just on the composer.json file that is used to define a package.
I have written a library that I want to use in another project. However, when I add the library dependency to my project I get the following error after running composer update -vvv:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for my/library dev-master -> satisfiable by my/library[dev-master].
- my/library dev-master requires doctrine/migrations 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.
This error is very confusing to me since my project has my library as it's only dependency, i.e. my project composer.json looks like this:
{
"name": "my/project",
"type": "project",
"description": "My project",
"autoload": {
"psr-0": { "MyNamespace\\": ["src/", "tests/src/"] }
},
"repositories": [ {
"type": "vcs",
"url": "git#bitbucket.org:my/library"
} ],
"require": {
"php": ">=5.5",
"my/library": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "3.*"
}
}
As you can see, pretty straight forward. The reason the version of my library is requiring dev-master is because master is currently the only branch I work on (I work alone, no need for other branches at the moment).
So far the only way for the resolve this problem is by adding the dependencies of my library composer.json to my project's composer.json which seems like an unnecessary step.
How can I resolve this dependency issue?
It looks to me as if it is a stability issue. Add the following two lines to your composer.json:-
"minimum-stability": "dev",
"prefer-stable": true,
ref:- minimum-stability & prefer-stable
Hopefully that will sort out your problem.