Composer failing with php version when --no-dev is passed - php

I have a composer file with a dev-dependency that requires PHP >= 5.4.0. When I update on production (a 5.3 install (yes - I know!)) and explicitly pass the --no-dev option, composer still checks for the PHP version requirements from the dev packages.
Composer file:
{
"config": {
"vendor-dir": "./vendor/"
},
"require": {
"symfony/config" : "dev-master",
"twig/twig": "1.15.1",
"leafo/lessphp": "v0.4.0",
"simplepie/simplepie": "dev-master",
"contao/idna": "dev-master",
"swiftmailer/swiftmailer": "5.3.*#dev",
"james-heinrich/getid3": "dev-master",
"pda/pheanstalk": "v2.1.0",
"monolog/monolog": "1.9.1",
"pimple/pimple": ">1.0.0",
"doctrine/orm": "2.4.*",
"ircmaxell/password-compat": "1.0.3",
"raven/raven": "dev-curl-async",
"elasticsearch/elasticsearch": "~1.0",
"guzzle/guzzle": "3.9.2"
},
"require-dev": {
"codeception/codeception": "2.1.*#dev"
}
}
Codeception has a requirement for PHP 5.4.0+ and when I run composer update --no-dev I get the following:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for codeception/codeception 2.1.*#dev -> satisfiable by codeception/codeception[2.1.x-dev].
- codeception/codeception 2.1.x-dev requires php >=5.4.0 -> no matching package found.
Should composer be skipping the requirements checks for packages I've explicitly told it not to install? I have tried passing --ignore-platform-reqs but without success.
UPDATE
It appears that running it on PHP 5.3.10 completely ignores the --no-dev option and reports that it is installaling them:
composer update --no-dev
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 codeception/codeception 2.1.*#dev -> satisfiable by codeception/codeception[2.1.x-dev].
- codeception/codeception 2.1.x-dev requires php >=5.4.0 -> no matching package found.

You need to use --no-dev to not install the dev packages.

Solved!!!
It appears my composer file was a bash script that wasn't passing the parameters to the composer.phar file correctly.
This problem was of my own creation.

Related

Composer not pulling in the right dependencies

Take a look at this composer.json snippet :
{
"require": {
"php": ">=7.0",
"illuminate/container": ">=5.0,<5.7",
"commerceguys/intl": "^0.7.3",
"jenssegers/date": ">=3.2.3,< 4.0"
},
"require-dev": {
"orchestra/testbench": "*",
"phpunit/phpunit": "*"
}
}
orchestra/testbench requires laravel/framework, and laravel/framework replaces all illuminate/* packages.
Now in my Travis builds there's something weird going on. For builds where I just run the tests in PHP 7.0 without any environment variables, I'd expect laravel/framework 5.x to be installed as it should replace illuminate/container and this one's version was constrained.
Yet, illuminate/container is installed separately and laravel/framework 4.2 is installed?!
The Travis builds of another package of mine using similar setup is performing just fine... The Illuminate package is NOT installed separately and laravel/framework is constrained by illuminate's version.
I'm quite clueless. I'd appreciate any help!
Here's the failing Travis build.

Unable to update symfony version using composer

I want to update the Symfony version of our app from 2.7.13 to 2.7.38.
I updated composer.json but when I try to update, it throws an error.
Command:
composer update symfony/symfony --with-dependencies
Error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- phpunit/phpunit 4.7.7 conflicts with symfony/symfony[v2.7.38].
This version of Symfony actively refuses to use phpunit/phpunit < 4.8.35 by using conflict in https://github.com/symfony/symfony/blob/v2.7.38/composer.json:
"conflict": {
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
},
You should upgrade "phpunit/phpunit" to a newer version in your own composer.json. Make sure you're not explicitly requiring a conflicted version and run composer update phpunit/phpunit (or just composer update to update all dependencies)
Try requiring the phpunit/bridge:
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},

Installation failed for phpunit/phpunit ^6.2

when i run
composer require --dev phpunit/phpunit
i get the following message:
composer require --dev phpunit/phpunit
Using version ^6.2 for phpunit/phpunit
./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
- Installation request for sebastian/object-enumerator (locked at 2.0.1) -> satisfiable by sebastian/object-enumerator[2.0.1].
- phpunit/phpunit 6.2.0 requires sebastian/object-enumerator ^3.0.2 -> satisfiable by sebastian/object-enumerator[3.0.2].
- phpunit/phpunit 6.2.1 requires sebastian/object-enumerator ^3.0.2 -> satisfiable by sebastian/object-enumerator[3.0.2].
- phpunit/phpunit 6.2.2 requires sebastian/object-enumerator ^3.0.2 -> satisfiable by sebastian/object-enumerator[3.0.2].
- phpunit/phpunit 6.2.3 requires sebastian/object-enumerator ^3.0.2 -> satisfiable by sebastian/object-enumerator[3.0.2].
- Conclusion: don't install sebastian/object-enumerator 3.0.2
- Installation request for phpunit/phpunit ^6.2 -> satisfiable by phpunit/phpunit[6.2.0, 6.2.1, 6.2.2, 6.2.3].
Installation failed, reverting ./composer.json to its original content.
Here is my composer json file:
"require": {
"php": "^7.0",
"laravel/framework": "^5.4",
"guzzlehttp/guzzle": "^6.3",
"symfony/psr-http-message-bridge": "^1.0",
"mcamara/laravel-localization": "^1.2",
"laravelcollective/html": "^5.4",
"laravel/socialite": "^3.0",
"yajra/laravel-datatables-oracle": "^7.9"
},
"require-dev": {
"fzaninotto/faker": "^1.6",
"symfony/css-selector": "^3.3",
"symfony/dom-crawler": "^3.3"
}
I tried to get from version 5.4 above and always get a similar error but with other dependecies, the only version that seems to work is 5.0
Run
$ composer require --dev phpunit/phpunit --update-with-dependencies
See https://getcomposer.org/doc/03-cli.md#require:
--update-with-dependencies: Also update dependencies of the newly required packages.
Note Deleting composer.lock in circumstances like this isn't really the best idea, as it might pull in dependencies that break your code in other places. You really only want to update a specific dependency at a time, rather than update all of them at once.
If you run a composer update with the composer.lock file and the vendor folder present, Composer will take the installed versions into accounts before updating.
Make sure you have the lock file committed into your project repository, to be able to restore the current version. Then try another update, but before that delete the lock file and vendor folder.
My experience is that such an update will not be affected by already installed versions which may prevent the necessary updates.
Another option for debugging the dependencies is to use composer why-not phpunit/phpunit 6.2.0 (use an explicit version you know exists - without version the output of the command is not meaningful). Composer will give you a list of dependencies that prevent the update, for you to investigate further.

laravel 5 composer update omnipay fails

I am having a problem with composer when I run composer update.
The relevant bits of my composer.json file looks like this:
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"omnipay/common": "~2.0",
"omnipay/authorizenet": "~2.0",
"omnipay/firstdata": "~2.0",
"omnipay/stripe": "~2.0",
"omnipay/paypal": "~2.0"
},
"minimum-stability": "dev",
When I run composer update, I receive the following error:
[Composer\DependencyResolver\SolverProblemsException]
Problem 1
- The requested package omnipay/common could not be found in any version, there may be a typo in the package name.
Problem 2
- Installation request for omnipay/authorizenet ~2.0 -> satisfiable by omnipay/authorizenet[2.5.0].
- omnipay/authorizenet 2.5.0 requires omnipay/common ~2.2 -> no matching package found.
Problem 3
- Installation request for omnipay/firstdata ~2.0 -> satisfiable by omnipay/firstdata[v2.3.0].
- omnipay/firstdata v2.3.0 requires omnipay/common ~2.0 -> no matching package found.
Problem 4
- Installation request for omnipay/stripe ~2.0 -> satisfiable by omnipay/stripe[v2.4.3].
- omnipay/stripe v2.4.3 requires omnipay/common ~2.0 -> no matching package found.
Problem 5
- Installation request for omnipay/paypal ~2.0 -> satisfiable by omnipay/paypal[v2.6.3].
- omnipay/paypal v2.6.3 requires omnipay/common ~2.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
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'm at a loss as to what direction to take to fix this or why it occurred in the first place. I last ran composer update several months ago and it ran with no issue.
There's no need to specifically require omnipay/common or omnipay/omnipay (which is a dummy package anyway).
(1) remove all of the omnipay/* lines from your composer.json
(2) The composer commands you need to bring your composer.json into having the correct versions are:
composer require omnipay/authorizenet
composer require omnipay/firstdata
composer require omnipay/stripe
composer require omnipay/paypal
Try running this command, I think composer will update your dependencies.
composer require omnipay/omnipay
I suppose the problem is with the package name. You can add omnipay/omnipay in your composer.json file as the package name.
I hope You Read All The Error Once. Its All Package You Declare is not found or not getting or its required update So, Just Remove the All The omipay packge form the Coposer.json and also Remove from ServiceProvider in config/app.php
Example Remove This Code Form Composer.json
"omnipay/common": "~2.0",
"omnipay/authorizenet": "~2.0",
"omnipay/firstdata": "~2.0",
"omnipay/stripe": "~2.0",
"omnipay/paypal": "~2.0"
And Then Try To Update Your Composer and Then After Install New Version Package From Here
I Hope Its Work For Your !!
Or
Follow This :
And Install The Package Again From :
https://packagist.org/packages/omnipay/paypal
And
https://github.com/thephpleague/omnipay-paypal

Symfony2 composer.phar install

Hi i want to install this bundle:
https://packagist.org/packages/knplabs/knp-paginator-bundle
"knplabs/knp-paginator-bundle": "2.3.*#dev"
But i dont want to screw something with composer.phar update because last time it killed some bundles functions in FOS bundle when i remember right.
So i did only::
sudo php composer.phar install
But i got this error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for symfony/framework-standard-edition 2.1.x-dev -> satisfiable by symfony/framework-standard-edition[2.1.x-dev].
- symfony/framework-standard-edition 2.1.x-dev requires knplabs/knp-paginator-bundle 2.3.*#dev -> 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.
And these are my requirements for symfony and php. It should be enough right? What's the problem then please?
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
try "minimum-stability": "dev"
see: http://getcomposer.org/doc/articles/troubleshooting.md
add the following line in your composer and update composer
"knplabs/knp-paginator-bundle": "dev-master"
I got the same. Then I tried to use php composer.phar update and it works.
Hope this will help!

Categories