简体   繁体   中英

Updating symfony/symfony version in composer.json

Looking at the Symfony demo repository, I find it hard to discern exactly which package you would target in order to update the symfony package.

Take a look here: https://github.com/symfony/demo/blob/master/composer.json

In my previous project, there was a distinct symfony/symfony package, so it was pretty clear where to do it.

Right now, my app is on version 4.2.5. I tried updating the symfony version at the bottom under extras : https://github.com/symfony/demo/blob/master/composer.json then ran composer update symfony/symfony .

Result:

$ composer update symfony/symfony
Package "symfony/symfony" listed for update is not installed. Ignoring.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.4.*"
Nothing to install or update

It's clear that there's been a change in procedure, and I'm sure there's docs for this somewhere, but I haven't been able to find it.

Without seeing your composer.json file, is hard to give you exact instructions. Symfony is both a framework and a collection of components, so we'd need to see how and what exactly you have installed.

For example, in a particular project I'm running these are all the dependencies that I updated to get to 4.4:

    "symfony/cache": "^4.4.0",
    "symfony/config": "^4.4.0",
    "symfony/console": "^4.4.0",
    "symfony/dependency-injection": "^4.4",
    "symfony/dotenv": "^4.4.0",
    "symfony/filesystem": "^4.4.0",
    "symfony/finder": "^4.4.0",
    "symfony/flex": "^1.2",
    "symfony/framework-bundle": "^4.4.0",
    "symfony/http-client": "^4.4.0",
    "symfony/http-client-contracts": "^2.0.0",
    "symfony/http-foundation": "^4.4.0",
    "symfony/http-kernel": "^4.4.0",
    "symfony/messenger": "^4.4.0",
    "symfony/monolog-bundle": "^3.4",
    "symfony/polyfill-mbstring": "^1.12.0",
    "symfony/profiler-pack": "^1.0",
    "symfony/routing": "4.4.0",

And on top of that, the extra key:

"extra": {
    "symfony": {
      "allow-contrib": true,
      "require": "4.4.*"
    }

The most important is probably "symfony/framework-bundle" , but you'll probably have something more.

In this case, almost all dependencies are declared explicitly, even if some of them would have been installed as dependencies of another package anyway, but we like to have all our real dependencies actually declared.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM