Skip to content

Instantly share code, notes, and snippets.

@mattstauffer
Last active January 11, 2018 02:01
Show Gist options
  • Save mattstauffer/4203242322e4e494e189 to your computer and use it in GitHub Desktop.
Save mattstauffer/4203242322e4e494e189 to your computer and use it in GitHub Desktop.
Comments for my Upgrading Laravel 4 to Laravel 5 post

Please note any missing pieces, wrong directions, or anything else in the comments. Thanks!

This is trying to catch all framework-related changes that are missing from my post RE upgrading Laravel 4 to 5.

@stygiansabyss
Copy link

Might want to change the copy configs over bit. Instead suggest they go through file by file and copy the values over as needed. A quick check showed 2 changes already, likely more than this, just checked 2 main configs to see.

config/app.php => new key 'log'
config/database.php => 'remember' key was changed to 'password'

@mattstauffer
Copy link
Author

Great note on that @StygianAbyss. Please, if anyone else notices any more of these, list them here.

@tomschlick
Copy link

For requiring illuminate/html you can use "~5.0" as the version instead of dev-master

@mattstauffer
Copy link
Author

Thanks @tomschlick; updated it.

@lynxtdc
Copy link

lynxtdc commented Jan 16, 2015

Hey Matt: Any tips on bringing over Form Macros?

@iWader
Copy link

iWader commented Jan 16, 2015

When you mention about the models folder, you shouldn't need to add the the autoloader as everything under app/ is autoloaded under PSR-4.

@mattstauffer
Copy link
Author

@iWader Thanks! However, if it was in the app/models directory in your old site, it's very likely that it was in the global namespace. app/models/User.php in PSR-4 would be the Model\User class, which isn't what the vast majority of people have when they have a Laravel 4 models directory. Hope that makes sense!

@mattstauffer
Copy link
Author

@lynxtdc Nope--someone more familiar with Form Macros will have to chip in and then I'll update the guide. Sorry!

@lynxtdc
Copy link

lynxtdc commented Jan 16, 2015

Thanks Matt

@dustingraham
Copy link

@mattstauffer @iWader The app/models folder was in the autoload classmap, but I think the idea here is that we need an additional namespace to prefix everything. I.E. I have a folder in L4 app/models/stuff/Thing.php which is namespace Stuff; and when copying stuff/* into the new Laravel 5 app/ folder app/stuff/Thing.php my namespace needs to prefix App (right?) so namespace App\Stuff; is what I'm understanding. Will attempt it soon.

@travisulrich
Copy link

@mattstauffer Thanks for putting this list together. Very helpful. Two little things that I came across when upgrading:

  • Str alias has been removed from default config/app.php. Most of the string functions are included in Illuminate\Support\Helpers or just add 'Str' => 'Illuminate\Support\Str' back in to the alias array
  • Paginator class has changed considerably. For simple/default uses, links() function can just be changed to render()

@jtgrimes
Copy link

@mattstauffer I know I'm late to this party, but I finally moved a site over today and found a couple steps I had to do - we'll see if this helps anyone.

Because we're not creating the project via composer, there are a couple commands that composer doesn't run for us and that we have to do by hand.

First, we need a .env file that Laravel is happy with. The easiest way to get one is to run cp .env.example .env. You can then update the new .env file with your settings as described in the article.

We need that .env file in place for the next step. Laravel requires that you set your application key, otherwise you'll get the following error: No supported encrypter found. The cipher and / or key length are invalid. To set the key, just run php artisan key:generate and a random key will be generated and placed in the .env file.

@Rjs37
Copy link

Rjs37 commented Sep 30, 2015

@mattstauffer Incredibly late to the party, but I've got a couple of comments to make.

First, thanks for the article, it's been a huge help in upgrading my sites and the accompanying package that I use.

Having worked through it all, I'd possibly clarify the git squash comments. Having never used it before, it took me a little while to realize that I didn't need to squash the first of the 3 commits (based on the example of 3 commits that you mentioned). I was trying to squash all 3 rather than just the latter ones. Incredibly useful feature though :)

Also the comment from @jtgrimes could definitely do with being added to the instructions.

@ajcastro
Copy link

ajcastro commented Jan 11, 2018

@mattstauffer, I run the command git merge laravel/master --squash but it errors

fatal: refusing to merge unrelated histories

How to solve this please?

@ajcastro
Copy link

^solved via --allow-unrelated-histories option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment