but these conflict with your requirements or minimum-stability - php

I am creating my own slackbot. I decided to use project as a library to help me.
https://github.com/sagebind/slack-client/issues?utf8=%E2%9C%93&q=stability
Now I need to install it with composer.
So I used the command: composer require coderstephen/slack-client
...And I get the error:
Problem 1
- Installation request for coderstephen/slack-client ^0.3.0 -> satisfiable by coderstephen/slack-client[v0.3.0].
- coderstephen/slack-client v0.3.0 requires devristo/phpws dev-master -> satisfiable by devristo/phpws[dev-master] but these conflict with your requirements or minimum-stability.
Ok - So then I decided to change my stability level to "dev" in my composer.lock:
"aliases": [],
"minimum-stability": "dev",
"stability-flags": {
"devristo/phpws": 20
},
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": ">=5.5"
},
"platform-dev": []
Now I'm running out of ideas on what to do. The README says to do this step in composer.json but, no such settings exist:
Please note that the current version has unstable dependencies.
In order to install those dependencies, you can set "minimum-stability" in your composer.json, and recommend that you set "prefer-stable":
My composer.json:
{
"name": "coderstephen/slack-client",
"keywords": ["slack", "api", "realtime"],
"license": "MIT",
"description": "A better Slack client, with RTM API support",
"authors": [{
"name": "Stephen Coakley",
"email": "me#stephencoakley.com"
}],
"require": {
"php": ">=5.5",
"devristo/phpws": "dev-master",
"evenement/evenement": "2.0.*",
"guzzlehttp/guzzle": "~6.0",
"react/event-loop": "^0.4.1",
"react/promise": "^2.2"
},
"require-dev": {
"phpunit/phpunit": "~4.6",
"fzaninotto/faker": "~1.4",
"apigen/apigen": "^4.1"
},
"autoload": {
"psr-4": {
"Slack\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Slack\\Tests\\": "tests"
}
}
}
Does anyone know some solutions I could try?

Add minimum-stability and prefer-stable to your composer.json (not composer.lock):
{
"name": "coderstephen/slack-client",
"keywords": ["slack", "api", "realtime"],
"license": "MIT",
"description": "A better Slack client, with RTM API support",
"authors": [{
"name": "Stephen Coakley",
"email": "me#stephencoakley.com"
}],
"require": {
"php": ">=5.5",
"devristo/phpws": "dev-master",
"evenement/evenement": "2.0.*",
"guzzlehttp/guzzle": "~6.0",
"react/event-loop": "^0.4.1",
"react/promise": "^2.2"
},
"require-dev": {
"phpunit/phpunit": "~4.6",
"fzaninotto/faker": "~1.4",
"apigen/apigen": "^4.1"
},
"autoload": {
"psr-4": {
"Slack\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Slack\\Tests\\": "tests"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}

For others having the same issue, these changes are best done using composer itself instead of manually modifying the composer.json file. Just run the following commands in the console:
$ composer config minimum-stability dev
$ composer config prefer-stable true
Now you can require and update the package:
$ composer require --no-update "vendor/package-name:version"
$ composer update
Available options (in order of stability) are dev, alpha, beta, RC, and stable

You should never manually edit the composer.lock file - it is an automatically generated file.
It looks like you've shown the composer.json file of the package you're trying to require rather than your own project's composer.json. The prefer-stable and minimum-stability properties should be added to your project root's composer.json file:
{
"name": "xFlare/slack-bot",
"description": "xFlare's Slack bot project",
"authors": [
{
"name": "xFlare"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=5.5",
"coderstephen/slack-client": "^0.3.0"
}
}

Usually, this issue has nothing to do directly with minimum-stability or prefer-stable option, but the case is just that you already use some library directly or indirectly, that is needed in another library you use but in a higher version.
My case: Got this error message for a Codeception library which needed a dependency of PHPUnit at least of version 6 and above (>= 6) , but it clashed with the lower version 4 of PHPUnit dependency, which I had installed/required directly already before prior it (as a package in my composer.json file). (my specific case could not use higher PHPUnit than version 6, since it was the last version which supported php version I used).
You might ask if it might affect your project, which already relies on the lower version of the library, perhaps there could be some breaking change, but I don't know if there could be some workaround for using one version for dependency and another version for own project.
Edit: I also had to issue a remove composer command for phpunit dependency, otherwise I was not able to increase my phpunit version directly.

You should add the minimum-stability in your composer.json not in the composer.lock. The option exists see https://getcomposer.org/doc/04-schema.md#minimum-stability

i had the error in a symfony4 project with own bundles.
my-foo-bundle dev-master requires ramsey/uuid-doctrine ^1.5 -> satisfiable by ramsey/uuid-doctrine[1.5.0, 1.6.0] but these conflict with your requirements or minimum-stability.
the solution, i search for "ramsey/uuid-doctrine" in my bundles and i found different requirements "ramsey/uuid-doctrine ^1.5" (in my-foo-bundle) and "ramsey/uuid-doctrine dev-master" (in my app-configuration). So i delete the requirement in the app/composer.json.
This worked for me.

Related

Facing issues on updating magento in magento cloud, updating magento to latest version of magento 2.3.2

Right now we are working on updating magento to latest version of magento 2.3.2
right now we are runing 2.2.7.
I following the guide for 2.3 branch found at
https://devdocs.magento.com/guides/v2.3/cloud/project/project-upgrade.html
I have taken following steps :
Step1: Update ece-tools version
On local workstation, perform an update using Composer
composer update magento/ece-tools
Add, commit, and push code changes.
git add -A && git commit -m “Update magento/ece-tools” && git push origin
Step2: Back up the database
Create a local backup of the remote database.
magento-cloud db:dump
when i run this command in my terminal i get
‘magento-cloud’ is not recognized as an internal or external command,
operable program or batch file.
Back up code and media.
php bin/magento setup:backup –code [–media]
To back up Staging or Production environment database before deploying
php vendor/bin/ece-tools db-dump
Step3: Complete the upgrade
I have PHP 7.1.30 version
Before completing the upgrade, update the autoload property
I follow all the steps giving in
https://devdocs.magento.com/guides/v2.3/comp-mgr/cli/cli-upgrade.html#update-autoload
set the upgrade version using
composer require magento/product-community-edition 2.3.2 –no-update
Then Update the project
composer update
After composer update i get some error
Your requirements could not be resolved to an installable set of packages.
Problem 1
- magento/magento-cloud-metapackage 2.2.7 requires magento/product-enterprise-edition 2.2.7 -> satisfiable by magento/product-enterprise-edition[2.2.7] but these conflict with your requirements or minimum-stability.
- magento/magento-cloud-metapackage 2.2.7 requires magento/product-enterprise-edition 2.2.7 -> satisfiable by magento/product-enterprise-edition[2.2.7] but these conflict with your requirements or minimum-stability.
- Installation request for magento/magento-cloud-metapackage >=2.2.7 <2.2.8 -> satisfiable by magento/magento-cloud-metapackage[2.2.7].
can you please guide me how can i solve this issue..
Thanks.
My composer.json like as
{
"name": "magento/project-enterprise-edition",
"description": "eCommerce Platform for Growth (Enterprise Edition)",
"type": "project",
"version": "2.3.2",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"repositories": {
"repo": {
"type": "composer",
"url": "https://repo.magento.com"
},
"amasty": {
"type": "composer",
"url": "https://composer.amasty.com/enterprise/"
}
},
"require": {
"magento/magento-cloud-metapackage": ">=2.2.7 <2.2.8",
"gene/bluefoot": "^1.0",
"amasty/promo": "^2.2",
"sashas/bug-from-email": "^2.0",
"amasty/shopby": "^2.11",
"amasty/label": "^1.10",
"connectpos/rest-api": "^1.1",
"magento/product-community-edition": "2.3.2",
"magento/product-enterprise-edition": "2.3.2"
},
"config": {
"use-include-path": true
},
"autoload": {
"psr-4": {
"Magento\\Framework\\": "lib/internal/Magento/Framework/",
"Magento\\Setup\\": "setup/src/Magento/Setup/",
"Magento\\": "app/code/Magento/",
"Zend\\Mvc\\Controller\\": "setup/src/Zend/Mvc/Controller/"
},
"psr-0": {
"": [
"app/code/",
"generated/code/"
]
},
"files": [
"app/etc/NonComposerComponentRegistration.php"
],
"exclude-from-classmap": [
"**/dev/**",
"**/update/**",
"**/Test/**"
]
},
"autoload-dev": {
"psr-4": {
"Magento\\Sniffs\\": "dev/tests/static/framework/Magento/Sniffs/",
"Magento\\Tools\\": "dev/tools/Magento/Tools/",
"Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
"Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
"Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/"
}
},
"minimum-stability": "alpha",
"prefer-stable": true,
"extra": {
"magento-force": true,
"magento-deploystrategy": "copy"
},
"require-dev": {
"allure-framework/allure-phpunit": "~1.2.0",
"friendsofphp/php-cs-fixer": "~2.13.0",
"lusitanian/oauth": "~0.8.10",
"magento/magento-coding-standard": "~1.0.0",
"magento/magento2-functional-testing-framework": "~2.3.14",
"pdepend/pdepend": "2.5.2",
"phpunit/phpunit": "~6.5.0",
"sebastian/phpcpd": "~3.0.0",
"squizlabs/php_codesniffer": "3.3.1"
}}
error command line screenshot
you need to remove
"magento/product-community-edition": "2.3.2",
"magento/product-enterprise-edition": "2.3.2"
from composer.json, will be installed as dependencies of magento-cloud-metapackage
and change metapackage version
Try to switch php to php 7.2 or greater . Because from magento 2.3.2 , it requires php version >= 7.2
I think you need to update magento/magento-cloud-metapackage as well with a compatible version of Magento 2.3.2.
I found one article https://technicallysound.in/magento-2-upgrade-and-composer-issues/ that tried to solve similar issues during the Magento upgrade. But it is for the Community edition. Anyway composer issues are similar. In case the article could help you check for an updated version of the magento/magento-cloud-metapackage.
Your composer.json should be the same as magento/magento-cloud/composer.json

Can't require local package with composer

I'm currently working on a Composer package and now I want to test how it would integrate in my current application without pushing it to a remote.
So I stumbled upon this blog post which explains how to do that. However, that didn't work. I'm getting the message
Your requirements could not be resolved to an installable set of packages.
Problem 1 - The requested package tzfrs/x-bundle could not be found in any version, there may be a typo in the package name.
My directory structure looks like this
dev
Project
composer.json
Package
composer.json
The composer.json of my package looks like this
{
"name": "tzfrs/x-bundle",
"license": "proprietary",
"require": {
"php": "^7.0",
"psr/log": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "~5.5"
},
"autoload": {
"psr-4": { "tzfrs\\XBundle\\": "" },
"exclude-from-classmap": [
"/Tests/"
]
}
}
And the one of my project looks like this (I'm leaving the symfony stuff and other packages/stuff out)
{
"repositories": [
{
"type": "git",
"url": "../Package",
}
],
"minimum-stability" : "beta",
"require": {
"tzfrs/x-bundle": "*"
}
}
So when doing composer update tzfrs/x-bundle I should get my new project right? However, I'm getting the message I posted above. What am I doing wrong here?
I already did git init in my package folder and also comitted all my changes. So I have a repo which is not empty already.

Composer: no matching package found

I create a widget that is under development. The problem is that when I run:
composer require chofoteddy/yii2-bootstrap-wizard "*"
I get the following message:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for chofoteddy/yii2-bootstrap-wizard * -> satisfiable by chofoteddy/yii2-bootstrap-wizard[dev-master].
- chofoteddy/yii2-bootstrap-wizard dev-master requires vinceg/twitter-bootstrap-wizard * -> 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 <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Installation failed, reverting ./composer.json to its original content.
What I seek is to add https://github.com/VinceG/twitter-bootstrap-wizard.git repository as a dependency of my project. "VinceG/twitter-bootstrap-wizard" is not registered in "Packagist".
I modified many times my composer.json file, in order to correct it, but I can not make it work.
My file composer.json:
{
"name": "chofoteddy/yii2-bootstrap-wizard",
"description": "Wizard form based on twitter bootstrap plugin (#VinceG)",
"homepage": "https://github.com/Chofoteddy/yii2-bootstrap-wizard",
"keywords": [
"yii2",
"wizard",
"bootstrap",
"yii2-extension"
],
"type": "yii2-extension",
"version": "0.1",
"license": "MIT",
"authors": [
{
"name": "Christopher",
"email": "chofoteddy88#yahoo.com.mx"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"VinceG/twitter-bootstrap-wizard": "*"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/VinceG/twitter-bootstrap-wizard"
}
],
"autoload": {
"psr-4": {
"chofoteddy\\wizard\\": ""
}
}
}
Composer information:
sudo composer self-update
You are already using composer version b2173d28fc8b56236eddc8aa10dcda61471633ec.
Because VinceG/twitter-bootstrap-wizard is not a Composer package (it does not include a composer.json) you have to define this in your composer.json
Your repository section should look like this:
"repositories": [
{
"type": "package",
"package": {
"name": "VinceG/twitter-bootstrap-wizard",
"version": "1.2",
"dist": {
"url": "https://github.com/VinceG/twitter-bootstrap-wizard/archive/1.2.zip",
"type": "zip"
},
"source": {
"url": "https://github.com/VinceG/twitter-bootstrap-wizard.git",
"type": "git",
"reference": "1.2"
}
}
}
],
You might also have a look at component-installer and the composer-asset-plugin to manage components and bower packages within composer.
The problem is probably the minimum-stability defined in your project root composer.json (or if not defined it defaults to stable)
As the bower repository has no release yet you should:
"VinceG/twitter-bootstrap-wizard": "#dev"
define minimum-stability: "#dev"
Please note that if you use this package from a different project you need to either define minimum-stability: "#dev" in that project or define the
"VinceG/twitter-bootstrap-wizard": "#dev" in root composer.json
There's also an option in composer which lets you specify: "prefer-stable"
More info on this:
https://igor.io/2013/02/07/composer-stability-flags.html

How to use the develop branch of Zend Framework 2 over composer?

In an Apigility driven application my composer.json is looking like this:
{
"name": "misc - myproject-api",
"description": "Skeleton Application for Apigility",
"require": {
"php": ">=5.3.23",
"zendframework/zendframework": ">=2.3.2,<3.0.0",
"zfcampus/zf-apigility": "~1.0",
"zfcampus/zf-apigility-documentation": "~1.0",
"zfcampus/zf-development-mode": "~2.0",
"zfcampus/zf-rest": "~1.0-dev",
"zf-commons/zfc-base": "dev-master",
"zendframework/zend-developer-tools": "dev-master",
"doctrine/doctrine-orm-module": "0.8.*"
},
"require-dev": {
"zendframework/zftool": "dev-master",
"zfcampus/zf-apigility-admin": "~1.0",
"zfcampus/zf-apigility-welcome": "~1.0",
"zfcampus/zf-deploy": "~1.0",
"zfr/zfr-cors": "~1.0",
"zend/zend-studio-development-mode": "~1.0"
},
"keywords": [
"api",
"apigility",
"framework",
"zf2"
],
"support": {
"email": "apigility-users#zend.com",
"irc": "irc://irc.freenode.net/apigility",
"source": "https://github.com/zfcampus/zf-apigility-skeleton",
"issues": "https://github.com/zfcampus/zf-apigility-skeleton/issues"
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev",
"dev-develop": "1.1-dev"
}
},
"config": {
"process-timeout": 5000
},
"type": "library",
"license": "BSD-3-Clause",
"homepage": "http://apigility.org/"
}
There is a ZF2 issue (that causes following error: Fatal error: Cannot use object of type Zend\Db\ResultSet\ResultSet as array). It has been fixed, but not merged to the master branch yet.
Since I need it working now, I tried to switch to the develop branch -- updated my composer.json
{
"name": "misc - myproject-api",
"description": "Skeleton Application for Apigility",
"require": {
"php": ">=5.3.23",
"zendframework/zendframework": "dev-develop as dev-master"
...
}
...
}
and executed a composer update:
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Updating zendframework/zendframework (dev-master de98f63 => dev-develop be0b349)
Checking out be0b3496b73a61a255d05e945b75f6fdf0995c31
Writing lock file
Generating autoload files
Problem: I'm not observing any changes, the code seems still to be loaded from the ZF2 master branch (e.g. my local Zend\Paginator\Adapter\DbSelect has exactly the state of the according class in the master branch).
How to load the ZF2 develop branch?
UPDATE
I've triedthe the composer require direction value for the develop branch (2.4.*#dev) from the Packagist page of the Zend Framework. The result is the same as with dev-develop or dev-develop as dev-master -- the console shows the correct branch (or better the correct commit be0b349) downloading
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Removing zendframework/zendframework (2.3.4)
- Installing zendframework/zendframework (dev-develop be0b349)
Cloning be0b3496b73a61a255d05e945b75f6fdf0995c31
Writing lock file
Generating autoload files
but after the updating, the code is still like in the master branch.
UPDATE
$ cd [project root directory]/vendor/zendframework/zendframework
$ git status
# On branch develop
nothing to commit (working directory clean)
That means, the branch is correct. And its also up-to-date, since the last commit , git log shows is be0b3496b73a61a255d05e945b75f6fdf0995c31 from 3d of February -- and that is actually the current HEAD revision.
So, the branch is correct, the revision is correct... Why is the code uot-of-date?
The "develop" branch has an alias to be version 2.4. You could require "2.4.*#dev" to get it.
If this breaks some of your dependencies, you could alias this with a 2.3 version.
"zendframework/zendframework": "dev-develop as 2.3.4.1"

Composer dependency without packagist

I have a project that has a dependency to 'webiny/crypt' package (I'm the owner of webiny/crypt repo also https://github.com/Webiny/Crypt).
{
"require": {
"webiny/crypt": "dev-master"
},
"minimum-stability": "dev"
}
Inside composer.json in webiny/crypt repo, I need to define a dependency to this repo: https://github.com/ircmaxell/php-cryptlib
That repo is not available on packagist, but inside its github repo it has a composer.json file.
I tried several solutions, but none of them worked. Here are some examples of what I tried...this is the content of composer.json of webiny/crypt.
Example 1:
"minimum-stability": "dev",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/ircmaxell/PHP-CryptLib"
}
],
"require": {
"php": ">=5.4.0",
"webiny/class-loader": "dev-master",
"webiny/config": "dev-master",
"webiny/std-lib": "dev-master",
"ircmaxell/PHP-CryptLib": "*"
}
Example 2:
"minimum-stability": "dev",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/ircmaxell/PHP-CryptLib"
}
],
"require": {
"php": ">=5.4.0",
"webiny/class-loader": "dev-master",
"webiny/config": "dev-master",
"webiny/std-lib": "dev-master",
"CryptLib/CryptLib": "*"
}
Also I tried both examples with 'dev-master' version instead of '*' on the CryptLib repo.
From the composer docs # https://getcomposer.org/doc/05-repositories.md#repository
Repositories are only available to the root package and the
repositories defined in your dependencies will not be loaded. Read the
FAQ entry if you want to learn why.
I think your only option, unless you want to tell your users to add that repo too, is to fork https://github.com/ircmaxell/PHP-CryptLib and then publish it to packagist. Maybe drop the author an email regarding this first tho.
Sorry, probably not the answer you were looking for.

Categories