how to upgrade laravel 6 to 7

Haneef Ansari picture Haneef Ansari · Mar 4, 2020 · Viewed 7.3k times · Source

i am trying to upgrade laravel 6 to 7, i got an error.

 our requirements could not be resolved to an installable set of
 packages.

   Problem 1
     - Conclusion: remove laravel/framework v6.0.3
     - Conclusion: don't install laravel/framework v6.0.3
     - laravel/ui 2.x-dev requires illuminate/console ^7.0 -> satisfiable by illuminate/console[7.x-dev, v7.0.0],
 laravel/framework[7.x-dev].
     - laravel/ui v2.0.0 requires illuminate/console ^7.0 -> satisfiable by illuminate/console[7.x-dev, v7.0.0],
 laravel/framework[7.x-dev].
     - Can only install one of: laravel/framework[7.x-dev, v6.0.3].
     - don't install illuminate/console 7.x-dev|don't install laravel/framework v6.0.3
     - don't install illuminate/console v7.0.0|don't install laravel/framework v6.0.3
     - Installation request for laravel/framework (locked at v6.0.3, required as ^6.0) -> satisfiable by laravel/framework[v6.0.3].
     - Installation request for laravel/ui ^2.0 -> satisfiable by laravel/ui[2.x-dev, v2.0.0].

Answer

Bira picture Bira · Mar 5, 2020

Just follow the documentation, you must have installed php7.2.5

Update your laravel/framework dependency to ^7.0 in your composer.json file.

In addition, update your nunomaduro/collision dependency to ^4.1,

phpunit/phpunit dependency to ^8.5,

facade/ignition to> `^2.0

After that as next step.

The report and render methods of your application's App\Exceptions\Handler class should accept instances of the Throwable interface instead of Exception instances:

use Throwable; // add this line

public function report(Throwable $exception); // replace Exception with Throwable
public function render($request, Throwable $exception); // replace Exception with Throwable

after that run

composer update