Unable to update symfony version using composer - php

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"
},

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.

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.

Why Composer require jquery installs unwanted PHP packages?

I just wanted jQuery and entered in the command line
composer require components/jquery ^1.11
But the log shows me:
Package operations: 4 installs, 0 updates, 0 removals
- Installing symfony/process (v3.2.7): Loading from cache
- Installing kriswallsmith/assetic (v1.4.0): Loading from cache
- Installing robloach/component-installer (0.2.3): Loading from cache
- Installing components/jquery (1.11.0): Loading from cache
Why does Composer install PHP related packages I never intended to install? And how do I get rid of the unwanted packages? Is there an better/cleaner install method?
you are trying to install on of 1.11 versions of a package, which is requires "robloach/component-installer" package to install , you can see that clearly here :
"require": {
"robloach/component-installer": "*"
},
however, robloach/component-installer requires some additional packages too,
also you can see that here
"require": {
"php": ">=5.3.2",
"kriswallsmith/assetic": "1.*",
"composer-plugin-api": "^1.0"
},

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

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.

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