Yes.. that's it!
Laravel 5.0 => 5.1 upgrade
Hello everybody, I have basic question and I just want to be sure that everything goes well. I want to upgrade my project from 5.0 to 5.1, so in order to upgrade I must go to composer.json, in "require" I should change from "laravel/framework": "5.0." to "laravel/framework": "5.1." or "laravel/framework": "5.1.0", follow these steps: http://laravel.com/docs/5.1/upgrade#upgrade-5.1.0 , and that's it? Thanks for help!
Yep. You could do 5.1.* to get the minor patches too, which is recommended in my opinion. If you get stuck, just ask a question.
5.1.* is all I did and took about 10 mins to update my app, awesomeness!!!!!
Thanks again guys, it just seemed too easy so I had to check :)
@Jasterrr there are no "breaking changes" being introduced so that's why it's easy :D
php-cs-fixer for PSR-2 on app/ and you'll be set :)
You may have to update some service providers if they break (doubt it since 5.1 doesn't break backwards compatibility)
Is 5.1 officially out? I'm a bit confused by this. The docs default to 5.0 and then there's "Master," which is 5.1 - are we calling the current version "Master" now on laravel.com or is it still considered beta?
Also, if I upgrade now, is it anticipated that there will be significant changes before it's officially released (again, if it isn't already)?
@opheliadesign It's released now ;) Master is now the branch for the next release (5.1.1) and 5.1 is the current released version ;)
Oh dang look at that! Was expecting fireworks or something.. ;) Woohoo!
I changed the composer requirement to 5.1.* and followed the instructions - everything seems to be working but I still Events and Commands directories and no Jobs or Listeners directories.
Have I cabbaged it?
@Shane I'm assuming that you just need to rename them. However, I renamed app\Handlers to app\Listeners and now the namespace in the only Handler I have in there throws an error when I change it to app\Listeners. Is this just my IDE? Am I missing something?
So far finding this to be the most confusing upgrade. Wish the documentation was a bit more thorough, had to look at the source on Github to figure some things out. For example, app\Handlers had two directories (can't remember what they were because I deleted them), in 5.1 it's an empty directory with a .gitkeep.
Also looks like I'll have to hunt down every place I used list(). Sounds like a breaking change to me?
I'm not having such an easy time... I updated my composer.json to require laravel/framework: 5.1.*, and ran composer update laravel/framework. However I get error messages such as
Problem 1
- Installation request for symfony/var-dumper == 2.6.7.0 -> satisfiable by symfony/var-dumper[v2.6.7].
- laravel/framework v5.1.0 requires symfony/var-dumper 2.7.* -> satisfiable by symfony/var-dumper[v2.7.0].
- laravel/framework v5.1.1 requires symfony/var-dumper 2.7.* -> satisfiable by symfony/var-dumper[v2.7.0].
- Conclusion: don't install symfony/var-dumper v2.7.0
- Installation request for laravel/framework 5.1.* -> satisfiable by laravel/framework[v5.1.0, v5.1.1].
Any help is appreciated.
@opheliadesign The two directories in app/Handlers were Commands and Events.
@BenG Do you have var-dumper in your composer.json?
@baileylo so they should be deleted, correct?
Also, I'm a bit confused by the deprecated items - are these things to take note of in the future or changes that can/should be made now?
I tried changing Illuminate\Contracts\Queue\ShouldBeQueued to Illuminate\Contracts\Queue\ShouldQueue but it seems that class does not exist.
Some notes from my update in case someone is interested:
A. config/app.php:
- The following does not exist for 5.1
'App\Providers\BusServiceProvider',
'App\Providers\ConfigServiceProvider',
- The default cipher is now different
5.0: 'cipher' => MCRYPT_RIJNDAEL_128,
5.1: 'cipher' => 'AES-256-CBC',
- The providers now use the ::class notation
5.0 'Illuminate\Foundation\Providers\ArtisanServiceProvider'
5.1 Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
B. Changes in composer.json
5.0
"require": {
"laravel/framework": "5.0.*"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
5.1
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
@opheliadesign I deleted both Commands and Events directories after renaming to Listeners since they do not exist in 5.1
@psampaz Would have been nice for this to be included in the upgrade instructions, although most do not appear to break anything if they aren't changed. What's the deal with adding ::class to the providers? And is there any potential to break something if I were to remove the unused Service Providers?
@opheliadesign read more about the ::class notation here http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class
It will not make any change if you leave it like it was in 5.0. It's just a new way to get a class name that was added in PHP 5.5
About the service providers I cannot give you a clear answer. It did not affect anything on my update. Maybe @JeffreyWay or @TaylorOtwell can.
Anyway if you want to see the exact changes compare the following:
5.0 https://github.com/laravel/laravel/blob/5.0/config/app.php
5.1 https://github.com/laravel/laravel/blob/master/config/app.php
When you do a composer update, should I be able to see some of the new file names etc?
@RobertDBroley it will just update whats in vendor, the rest of the changes you need to make on your own throughout your project.
I have noticed its taken away the authentication that was shipped with 5.0, so you manually have to set all this up now which is rather annoying. Some of the new features look good but why remove the authtication
@RobertDBroley I agree, I think it should have been left in or at least have an option to include it when creating a new project. Nonetheless, setting up Auth on 5.1 is documented here: http://laravel.com/docs/5.1/authentication#authentication-quickstart
I had the barryvdh IDE helper for PHPstorm in my composer.json which really upset the update process. Finally removed that and climbed back out of the rabbit hole.
@RobertDBroley Well thank goodness for this thread. I happen to just be learning laravel and was very confused when the new projects I'm creating today weren't installing correctly, and then after an update were missing things that came included yesterday and I couldn't figure out what I'd messed up. I'm glad I still have a demo new project from yesterday to compare to.
I changed my require from the current laravel to 5.1 and got an error message saying no such file or directory
I followed the steps as you suggested but I am having error like this..
[ErrorException]
file_put_contents(/home/vagrant/Code/Example/bootstrap/cache/services/json) : failed to open stream: No such file or directory
Script php artisan clear-compiled handling the post-update-cmd event returend with the error
make sure to create a cache dir under bootstrap.
@jimmack it worked. Thanks
@BenG I was having the same problem when running composer update laravel/framework, fixed by just running composer update.
After update I get : 'Class 'GuzzleHttp\Client' not found' File name: /Users/martin/Desktop/Projects/restaurant-hotspot/vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php
Please or to participate in this conversation.