Upgrading to Laravel 6

2019-09-06 20:08:14

Laravel 6.0 is out, and it’s update time for Bloganueva! For those of you who don’t know, Laravel is a fire PHP Framework that I used to create this site. I really enjoy using it, so if you’re looking for something like this, try it out! Now here are the steps I followed to upgrade (these steps are only for MacOS).

Update PHP

Laravel 6.0 requires PHP 7.2, so first you need to update your PHP version. Here are the terminal commands I used.

brew install php72
brew services stop php71
brew unlink php71
brew link php72
brew services start php72

At this point I tried visiting my local install of Bloganueva, but I received a 502 BAD GATEWAY. I Googled around and found I may need to uninstall my PHP 7.1 installation, so I did that.

brew uninstall php71

Then I reinstalled Valet. Valet is the development environment I use. It’s really easy to setup and use! I highly recommend.

valet install

Update plugins

After all this is done, make sure the plugins you installed are all updated in your composer.json file. Just Google their repositories, and most of them either will just work with the new update or give you explicit instructions on the version you need to require. I did this, and then I ran composer update.

I got an error for the helper str_slug. In Laravel’s upgrade docs it says they were moved somewhere else, so I needed to required that package.

composer require laravel/helpers

Then I ran composer update for the last time. Everything worked! I had no more errors. I checked my Laravel install, and it said I’m running Laravel 6.0.1. Success!

After you get all this done, you should go through your site and test to see if anything is broken. I ran into an issue with my search. It said the Input facade I was using wasn’t found. In the Laravel’s upgrade docs (again), it says the Input facade was removed and to just use the Request facade. I changed use Illuminate\Support\Facades\Input; to use Illuminate\Support\Facades\Request;and Input::get to Request::get, and it worked! I did more testing and found no other issues!

This was a pretty easy update process, but I wanted to document everything I ran into because I knew I would run into something. Hope this helps if you need it!

Updated at: 2019-09-06 20:11:37

Tags: development software technology laravel php


Read More From development