简体   繁体   中英

How can I update laravel/laravel from 5.3 to 5.4?

I have attempted to update laravel/laravel from 5.3 to 5.4 , and to do so, I have modified composer.json to this:

 {
        "name" : "laravel/laravel",
        "description" : "The Laravel Framework.",
        "keywords" : [
            "framework",
            "laravel"
        ],
        "license" : "MIT",
        "type" : "project",
        "require" : {
            "php" : ">=5.6.4",
            "laravel/framework" : "5.4.*",
            "h4cc/wkhtmltopdf-amd64" : "0.12.x",
            "h4cc/wkhtmltoimage-amd64" : "0.12.x",
            "barryvdh/laravel-snappy" : "^0.3.3",
            "greggilbert/recaptcha" : "dev-master"
        },
        "require-dev" : {
            "fzaninotto/faker" : "~1.4",
            "mockery/mockery" : "0.9.*",
            "phpunit/phpunit" : "~5.7",
            "symfony/css-selector" : "2.8.*|3.0.*",
            "symfony/dom-crawler" : "2.8.*|3.0.*",
            "barryvdh/laravel-ide-helper" : "^2.2",
            "guzzlehttp/guzzle" : "~6.0"
        },
        "autoload" : {
            "classmap" : [
                "database"
            ],
            "psr-4" : {
                "App\\" : "app/"
            }
        },
        "autoload-dev" : {
            "classmap" : [
                "tests/TestCase.php"
            ]
        },
        "scripts" : {
            "post-root-package-install" : "php -r \"copy('.env.example', '.env');\"",
            "post-create-project-cmd" : "php artisan key:generate",
            "post-install-cmd" : [
                "Illuminate\\Foundation\\ComposerScripts::postInstall",
                "php artisan optimize"
            ],
            "post-update-cmd" : [
                "Illuminate\\Foundation\\ComposerScripts::postUpdate",
                "php artisan optimize"
            ]
        },
        "config" : {
            "preferred-install" : "dist"
        }
    }

Then I ran

$ composer update

It seems that composer did not do anything:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 0 updates, 0 removals
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
Generating optimized class loader
The compiled class file has been removed.

When I then ran

$ php artisan --version

the output is:

Laravel Framework version 5.3.31

In composer.lock I find this:

    {
        "name": "laravel/framework",
        "version": "v5.3.31",
        "source": {
            "type": "git",
            "url": "https://github.com/laravel/framework.git",
            "reference": "e641e75fc5b26ad0ba8c19b7e83b08cad1d03b89"
        },
        "dist": {
            "type": "zip",
            "url": "https://api.github.com/repos/laravel/framework/zipball/e641e75fc5b26ad0ba8c19b7e83b08cad1d03b89",
            "reference": "e641e75fc5b26ad0ba8c19b7e83b08cad1d03b89",
            "shasum": ""
        },
        "require": {
            "classpreloader/classpreloader": "~3.0",
            "doctrine/inflector": "~1.0",
            "ext-mbstring": "*",
            "ext-openssl": "*",
            "jeremeamia/superclosure": "~2.2",
            "league/flysystem": "~1.0",
            "monolog/monolog": "~1.11",
            "mtdowling/cron-expression": "~1.0",
            "nesbot/carbon": "~1.20",
            "paragonie/random_compat": "~1.4|~2.0",
            "php": ">=5.6.4",
            "psy/psysh": "0.7.*|0.8.*",
            "ramsey/uuid": "~3.0",
            "swiftmailer/swiftmailer": "~5.4",
            "symfony/console": "3.1.*",
            "symfony/debug": "3.1.*",
            "symfony/finder": "3.1.*",
            "symfony/http-foundation": "3.1.*",
            "symfony/http-kernel": "3.1.*",
            "symfony/process": "3.1.*",
            "symfony/routing": "3.1.*",
            "symfony/translation": "3.1.*",
            "symfony/var-dumper": "3.1.*",
            "vlucas/phpdotenv": "~2.2"
        },
        "replace": {
            "illuminate/auth": "self.version",
            "illuminate/broadcasting": "self.version",
            "illuminate/bus": "self.version",
            "illuminate/cache": "self.version",
            "illuminate/config": "self.version",
            "illuminate/console": "self.version",
            "illuminate/container": "self.version",
            "illuminate/contracts": "self.version",
            "illuminate/cookie": "self.version",
            "illuminate/database": "self.version",
            "illuminate/encryption": "self.version",
            "illuminate/events": "self.version",
            "illuminate/exception": "self.version",
            "illuminate/filesystem": "self.version",
            "illuminate/hashing": "self.version",
            "illuminate/http": "self.version",
            "illuminate/log": "self.version",
            "illuminate/mail": "self.version",
            "illuminate/notifications": "self.version",
            "illuminate/pagination": "self.version",
            "illuminate/pipeline": "self.version",
            "illuminate/queue": "self.version",
            "illuminate/redis": "self.version",
            "illuminate/routing": "self.version",
            "illuminate/session": "self.version",
            "illuminate/support": "self.version",
            "illuminate/translation": "self.version",
            "illuminate/validation": "self.version",
            "illuminate/view": "self.version",
            "tightenco/collect": "self.version"
        },
        "require-dev": {
            "aws/aws-sdk-php": "~3.0",
            "mockery/mockery": "~0.9.4",
            "pda/pheanstalk": "~3.0",
            "phpunit/phpunit": "~5.4",
            "predis/predis": "~1.0",
            "symfony/css-selector": "3.1.*",
            "symfony/dom-crawler": "3.1.*"
        },
        "suggest": {
            "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (~3.0).",
            "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).",
            "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).",
            "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (~5.3|~6.0).",
            "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).",
            "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).",
            "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0).",
            "predis/predis": "Required to use the redis cache and queue drivers (~1.0).",
            "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~2.0).",
            "symfony/css-selector": "Required to use some of the crawler integration testing tools (3.1.*).",
            "symfony/dom-crawler": "Required to use most of the crawler integration testing tools (3.1.*).",
            "symfony/psr-http-message-bridge": "Required to use psr7 bridging features (0.2.*)."
        },
        "type": "library",
        "extra": {
            "branch-alias": {
                "dev-master": "5.3-dev"
            }
        },

What's wrong ?

Thank's in advance for any help.

Instead of editing composer.json , try running

composer require laravel/laravel:^5.4.0 --update-with-dependencies

For reference, see https://getcomposer.org/doc/03-cli.md#require .

--update-with-dependencies : Also update dependencies of the newly required packages.

Note There's rarely a reason to manually modify composer.json , especially not when corresponding commands are available.

它适用于:

composer require laravel/framework:^5.4.0 --update-with-dependencies

It doesn't work but there is error log :

 composer require laravel/laravel:^5.4.0 --update-with-dependencies
./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
    - The requested package laravel/laravel No version set (parsed as 1.0.0) is satisfiable by laravel/laravel[No version set (parsed as 1.0.0)] but these conflict with your requirements or minimum-stability.
  Problem 2
    - laravel/laravel v5.5.0 requires php >=7.0.0 -> your PHP version (5.6.30) does not satisfy that requirement.
    - laravel/laravel v5.4.9 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, v5.4.0, v5.4.1, v5.4.10, v5.4.11, v5.4.12, v5.4.13, v5.4.14, v5.4.15, v5.4.16, v5.4.17, v5.4.18, v5.4.19, v5.4.2, v5.4.20, v5.4.21, v5.4.22, v5.4.23, v5.4.24, v5.4.25, v5.4.26, v5.4.27, v5.4.28, v5.4.29, v5.4.3, v5.4.30, v5.4.31, v5.4.32, v5.4.33, v5.4.34, v5.4.35, v5.4.36, v5.4.4, v5.4.5, v5.4.6, v5.4.7, v5.4.8, v5.4.9] but these conflict with your requirements or minimum-stability.
    - laravel/laravel v5.4.30 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, v5.4.0, v5.4.1, v5.4.10, v5.4.11, v5.4.12, v5.4.13, v5.4.14, v5.4.15, v5.4.16, v5.4.17, v5.4.18, v5.4.19, v5.4.2, v5.4.20, v5.4.21, v5.4.22, v5.4.23, v5.4.24, v5.4.25, v5.4.26, v5.4.27, v5.4.28, v5.4.29, v5.4.3, v5.4.30, v5.4.31, v5.4.32, v5.4.33, v5.4.34, v5.4.35, v5.4.36, v5.4.4, v5.4.5, v5.4.6, v5.4.7, v5.4.8, v5.4.9] but these conflict with your requirements or minimum-stability.
    - laravel/laravel v5.4.3 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, v5.4.0, v5.4.1, v5.4.10, v5.4.11, v5.4.12, v5.4.13, v5.4.14, v5.4.15, v5.4.16, v5.4.17, v5.4.18, v5.4.19, v5.4.2, v5.4.20, v5.4.21, v5.4.22, v5.4.23, v5.4.24, v5.4.25, v5.4.26, v5.4.27, v5.4.28, v5.4.29, v5.4.3, v5.4.30, v5.4.31, v5.4.32, v5.4.33, v5.4.34, v5.4.35, v5.4.36, v5.4.4, v5.4.5, v5.4.6, v5.4.7, v5.4.8, v5.4.9] but these conflict with your requirements or minimum-stability.
    - laravel/laravel v5.4.23 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, v5.4.0, v5.4.1, v5.4.10, v5.4.11, v5.4.12, v5.4.13, v5.4.14, v5.4.15, v5.4.16, v5.4.17, v5.4.18, v5.4.19, v5.4.2, v5.4.20, v5.4.21, v5.4.22, v5.4.23, v5.4.24, v5.4.25, v5.4.26, v5.4.27, v5.4.28, v5.4.29, v5.4.3, v5.4.30, v5.4.31, v5.4.32, v5.4.33, v5.4.34, v5.4.35, v5.4.36, v5.4.4, v5.4.5, v5.4.6, v5.4.7, v5.4.8, v5.4.9] but these conflict with your requirements or minimum-stability.
    - laravel/laravel v5.4.21 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, v5.4.0, v5.4.1, v5.4.10, v5.4.11, v5.4.12, v5.4.13, v5.4.14, v5.4.15, v5.4.16, v5.4.17, v5.4.18, v5.4.19, v5.4.2, v5.4.20, v5.4.21, v5.4.22, v5.4.23, v5.4.24, v5.4.25, v5.4.26, v5.4.27, v5.4.28, v5.4.29, v5.4.3, v5.4.30, v5.4.31, v5.4.32, v5.4.33, v5.4.34, v5.4.35, v5.4.36, v5.4.4, v5.4.5, v5.4.6, v5.4.7, v5.4.8, v5.4.9] but these conflict with your requirements or minimum-stability.
    - laravel/laravel v5.4.19 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, v5.4.0, v5.4.1, v5.4.10, v5.4.11, v5.4.12, v5.4.13, v5.4.14, v5.4.15, v5.4.16, v5.4.17, v5.4.18, v5.4.19, v5.4.2, v5.4.20, v5.4.21, v5.4.22, v5.4.23, v5.4.24, v5.4.25, v5.4.26, v5.4.27, v5.4.28, v5.4.29, v5.4.3, v5.4.30, v5.4.31, v5.4.32, v5.4.33, v5.4.34, v5.4.35, v5.4.36, v5.4.4, v5.4.5, v5.4.6, v5.4.7, v5.4.8, v5.4.9] but these conflict with your requirements or minimum-stability.
    - laravel/laravel v5.4.16 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, v5.4.0, v5.4.1, v5.4.10, v5.4.11, v5.4.12, v5.4.13, v5.4.14, v5.4.15, v5.4.16, v5.4.17, v5.4.18, v5.4.19, v5.4.2, v5.4.20, v5.4.21, v5.4.22, v5.4.23, v5.4.24, v5.4.25, v5.4.26, v5.4.27, v5.4.28, v5.4.29, v5.4.3, v5.4.30, v5.4.31, v5.4.32, v5.4.33, v5.4.34, v5.4.35, v5.4.36, v5.4.4, v5.4.5, v5.4.6, v5.4.7, v5.4.8, v5.4.9] but these conflict with your requirements or minimum-stability.
    - laravel/laravel v5.4.15 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, v5.4.0, v5.4.1, v5.4.10, v5.4.11, v5.4.12, v5.4.13, v5.4.14, v5.4.15, v5.4.16, v5.4.17, v5.4.18, v5.4.19, v5.4.2, v5.4.20, v5.4.21, v5.4.22, v5.4.23, v5.4.24, v5.4.25, v5.4.26, v5.4.27, v5.4.28, v5.4.29, v5.4.3, v5.4.30, v5.4.31, v5.4.32, v5.4.33, v5.4.34, v5.4.35, v5.4.36, v5.4.4, v5.4.5, v5.4.6, v5.4.7, v5.4.8, v5.4.9] but these conflict with your requirements or minimum-stability.
    - laravel/laravel v5.4.0 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, v5.4.0, v5.4.1, v5.4.10, v5.4.11, v5.4.12, v5.4.13, v5.4.14, v5.4.15, v5.4.16, v5.4.17, v5.4.18, v5.4.19, v5.4.2, v5.4.20, v5.4.21, v5.4.22, v5.4.23, v5.4.24, v5.4.25, v5.4.26, v5.4.27, v5.4.28, v5.4.29, v5.4.3, v5.4.30, v5.4.31, v5.4.32, v5.4.33, v5.4.34, v5.4.35, v5.4.36, v5.4.4, v5.4.5, v5.4.6, v5.4.7, v5.4.8, v5.4.9] but these conflict with your requirements or minimum-stability.
    - Installation request for laravel/laravel ^5.4.0 -> satisfiable by laravel/laravel[v5.4.0, v5.4.15, v5.4.16, v5.4.19, v5.4.21, v5.4.23, v5.4.3, v5.4.30, v5.4.9, v5.5.0].

我已经通过编辑几个文件中的一些小改动将laravel项目从5.3转换为5.4

If like to upgrade Laravel 5.3 to Laravel5.4

You change the laravel/framework: 5.3.* to 5.4.*

You change the phpunit/phpunit: ̴~5.7

you chnage the : "laravelcollective/html": "^5.4.0"

Then move to your terminal and run composer update

If it exists, you may delete the bootstrap/cache/compiled.php file. It is no longer used by the framework.

After upgrading all packages, you should run php artisan view:clear to avoid Blade errors related to the removal of Illuminate\\View\\Factory::getFirstLoop()*. In addition, you may need to run php artisan route:clear to flush the route cache.

Just do

composer update laravel/framework --with-all-dependencies

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