Skip to content

Conversation

driesvints
Copy link
Member

This pull request includes the changes for upgrading to Laravel 8.x. Feel free to commit any additional changes to the shift-35839 branch.

Before merging, you need to:

  • Checkout the shift-35839 branch
  • Review all pull request comments for additional changes
  • Update your dependencies for Laravel 8
  • Run composer update (if the scripts fail, add --no-scripts)
  • Thoroughly test your application (no tests?)

If you need help with your upgrade, check out the Human Shifts. You may also join the Shifty Coders Slack workspace to level-up your Laravel skills.

The Laravel framework adopts the PSR-2 coding style with some additions.
Laravel apps *should* adopt this coding style as well.

However, Shift allows you to customize the adopted coding style by
adding your own [PHP CS Fixer][1] `.php_cs` config to your project.

You may use [Shift's .php_cs][2] file as a base.

[1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer
[2]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200
In an effort to make upgrading the constantly changing config files
easier, Shift defaulted them. This allows you to review the commit
diff for once for customizations when you are done Shifting.

Moving forward, consider using ENV variables or create a separate
config file to allow the core config files to remain as default
as possible.
@driesvints
Copy link
Member Author

driesvints commented Nov 3, 2020

❌ Shift could not upgrade the following files since they differed from the default Laravel version. You will need to compare these files against the default Laravel 8 versions and merge any changes:

  • public/index.php

@driesvints
Copy link
Member Author

ℹ️ Laravel 8 streamlined the Exception Handler into a single register method to make it easier to add custom logic around rendering or reporting errors within your application.

While this change is not required, Shift recommends comparing yours against the Laravel 8.x version as an opportunity to reduce code and be fully up-to-date.

@driesvints
Copy link
Member Author

❌ To match the other auth middleware, Laravel 8 now allows multiple guards for the RedirectIfAuthenticated middleware.

Shift attempted to automate these changes, but detected customizations. You will need to compare your app/Http/Middleware/RedirectIfAuthenticated.php with the default Laravel 8 version to finalize the upgrade.

@driesvints
Copy link
Member Author

ℹ️ The RouteServiceProvider no longer prefixes the controller namespace by default in Laravel 8. While you may still set this property, you are encouraged to register your routes using static ::class references.

You may automate the conversion to static class references using the Shift Workbench.

@driesvints
Copy link
Member Author

❌ Laravel 8 condenses the RouteServiceProvider as well as configured the new rate limiters. Shift was unable to automate this change. You should compare yours against the Laravel 8.x version and merge any changes.

@driesvints
Copy link
Member Author

ℹ️ Laravel 8 introduced class based factories. Shift automated this change. However, if you were using a community package for factories or other custom code, you should review your factories for additional changes.

If you encounter an issue, you may revert this commit and temporarily install the laravel/legacy-factories package. You may then automate the conversion to class based factories using the Shift Workbench.

@driesvints
Copy link
Member Author

ℹ️ Laravel 8 added a uuid column to the failed_jobs table to support the new job batching features.

If your application is currently using the failed_jobs table, you may generate a custom migration for this command by running:

php artisan make:migration AddUuidToFailedJobsTable

Then copy and paste the contents from Shift's AddUuidToFailedJobsTable class.

@driesvints
Copy link
Member Author

ℹ️ Laravel 8 added a new ENV variable of LOG_LEVEL. While the log level is defaulted in the configuration, you may take this opportunity to set it accordingly in your environments.

@driesvints
Copy link
Member Author

⚠️ Shift upgraded your configuration files by defaulting them and merging your true customizations. These include values which are not changeable through core ENV variables. This should make maintaining your config files easier.

You should review this commit for any additional customizations. If you have a lot of customizations, you may wish to undo this commit with git revert and make these config file changes manually.

@driesvints
Copy link
Member Author

ℹ️ Shift detected a dependency for livewire/livewire. Livewire 2 is now available. However, this requires additional changes to your application.

Shift did not update your dependency as it is compatible with Laravel 8.

@driesvints
Copy link
Member Author

ℹ️ Shift updated your dependencies for Laravel 8. While many of the popular packages are reviewed, you may have to update additional packages in order for your application to be compatible with Laravel 8.

Watch dealing with dependencies for tips on handling package incompatibilities.

@driesvints
Copy link
Member Author

⚠️ Laravel 8 now requires PHPUnit 9 which made some configuration changes to its config file. You may automate these changes by running vendor/bin/phpunit --migrate-configuration or comparing your phpunit.xml to the Laravel 8 version and merging any changes.

@driesvints
Copy link
Member Author

⚠️ The paginator now uses Tailwind for its default styling in Laravel 8. If you wish to continue using Bootstrap, you should add the following snippet to the boot method of your AppServiceProvider:

\Illuminate\Pagination\Paginator::useBootstrap();

@driesvints
Copy link
Member Author

⚠️ Shift detected you are using a Laravel package like Horizon or Nova which may need to have its published assets regenerated after upgrading. Be sure to use artisan to republish these assets as well as php artisan view:clear to avoid any errors.

@driesvints
Copy link
Member Author

🎉 Congratulations, you're now running the latest version of Laravel.

The following Shifts may be used ensure your application is fully upgraded and easier to maintain in the future:

  • Upgrade Checker ensures your application is fully upgraded by detecting any outdated code.
  • Laravel Fixer automates many of the suggestions found by the Laravel Linter and other Shifts.
  • Tests Generator intelligently generates model factories, HTTP Tests, and unit tests for your application to give you a head start on testing.

You may run these Shifts and stay upgraded forever as well by subscribing to a Shifty Plans.

@joedixon
Copy link
Contributor

joedixon commented Nov 3, 2020

@driesvints I think this is good to go

@driesvints
Copy link
Member Author

@joedixon just a few remarks.

@joedixon
Copy link
Contributor

joedixon commented Nov 5, 2020

@driesvints pinging you here as I can't add request a review as it's your PR. Made all changes except the one I commented on above.

@joedixon
Copy link
Contributor

joedixon commented Nov 5, 2020

How's that?

@driesvints driesvints merged commit ae60969 into main Nov 5, 2020
@driesvints driesvints deleted the shift-35839 branch November 5, 2020 13:11
@driesvints
Copy link
Member Author

Perfect. Thanks Joe!

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

Successfully merging this pull request may close these issues.

3 participants