11

I want to upgrade Laravel to 5.7 because I need new features, but I can't find any easy way.

I followed these steps:-Upgrading Laravel Version but I found an error during composer update

I got this error and I also tried to solve the solution but it is not working

My composer.json file:

    {
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "5.7.*",
        "laravel/tinker": "^1.0"
    },
    "require-dev": {
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "phpunit/phpunit": "^7.0"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

How do I upgrade Laravel 5.6 to 5.7 with full instructions?

Udhav Sarvaiya
  • 9,380
  • 13
  • 53
  • 64

3 Answers3

19

Just update your laravel/framework dependency to 5.7.* in your composer.json file. Since you are upgrading from 5.6 to 5.7 then, you can easily just run composer update

And if you were doing custom modifications in your 5.6 application, then you can check the Upgrade Guide for a more detailed info.

Dexter Bengil
  • 5,995
  • 6
  • 35
  • 54
  • 2
    Yeah, this _might_ work if you aren't doing anything custom. But more than likely it won't or when you go to upgrade to a later version it definitely won't and you'll be scratching your head. I recommend at least reading through the {Upgrade Guide](https://laravel.com/docs/5.7/upgrade) and shamelessly recommend [Laravel Shift](https://laravelshift.com). – Jason McCreary Mar 05 '19 at 21:06
3

I just upgrade laravel to 5.8 with following simple steps:

  1. update in composer.json with "laravel/framework": "5.8.*", enter image description here
  2. Then in console run composer update
  3. Then some library cause problem like in my case yajra/laravel-datatables-oracle enter image description here
  4. Remove line from composer.json file "yajra/laravel-datatables-oracle": "~8.0",
  5. Again in console composer update
  6. Then last Error will be in trustedproxy.php in line 66 enter image description here to get rid from this error:

    a. Remove file trustedproxy.php from config folder of project b. Remove line "fideloper/proxy": "~3.3" c. Again in console composer update

  7. At this point there is error so at last add all the library that we remove before In my case, I in console composer require yajra/laravel-datatables-oracle and composer require fideloper/proxy then at last composer update in console. That's it, hope this help someone.
Rajkumar Sharma
  • 554
  • 1
  • 4
  • 9
1

I followed a tutorial

https://www.codementor.io/magarrent/how-to-install-laravel-5-xampp-windows-du107u9ji

to install Laravel with Composer on windows. Being new to the PHP world, I didn't realize that 5.1 wasn't the newest version.

I couldn't find an easy way to uninstall it and reinstall or just upgrade to the newest version( at this point 5.8). kept getting errors :

λ composer create-project laravel/laravel laravel "5.7."*

Installing laravel/laravel (v5.7.28) [InvalidArgumentException] Project directory laravel/ is not empty. enter mission change file name. &

λ composer update

Composer could not find a composer.json file in C:\xampp\htdocs To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section &

λ composer global remove laravel/installer

Changed current directory to C:/Users/lenovo/AppData/Roaming/Composer [RuntimeException] Could not read ./composer.json

file_get_contents(./composer.json): failed to open stream: No such file or directory

I navigated in file explorer to:

C:\xampp\htdocs

I :

  1. navigate to C:\xampp\htdocs
  2. highlighted the laravel folder
  3. right click rename "laravel2"

I repasted the install script in commandLine,this time with 5.8 in place of 5.1.

C:\xampp\htdocs λ composer create-project laravel/laravel laravel "5.8."*

bingo

Delete the renamed file: "laravel2".

"windows is moving 4888 files to recycle bin"