Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 7.x Shift #778

Open
wants to merge 8 commits into
base: laravel7
Choose a base branch
from
Open

Laravel 7.x Shift #778

wants to merge 8 commits into from

Conversation

samdb
Copy link
Contributor

@samdb samdb commented Apr 7, 2020

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

Before merging, you need to:

  • Checkout the shift-25927 branch
  • Review all pull request comments for additional changes
  • Update your dependencies for Laravel 7
  • 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 so you can review the commit diff for
changes. Moving forward, you should use ENV variables or create a
separate config file to allow the core config files to remain
automatically upgradeable.
@samdb
Copy link
Contributor Author

samdb commented Apr 7, 2020

ℹ️ Laravel 7 upgraded to Symfony 5 which passes instances of the Throwable interface instead of Exception instances to core components like the Exceptions\Handler.

Shift automated this change. However, if you receive a Throwable type mismatch error there may be additional references you need to convert.

@samdb
Copy link
Contributor Author

samdb commented Apr 7, 2020

ℹ️ Laravel 7 moved the Authentication components into a separate laravel/ui package, which includes the make commands as well as the traits related to authentication.

Shift added this dependency for convenience. However, if you do not plan to use the Authentication components, you may remove this dependency as well as the Auth controllers from your application.

@samdb
Copy link
Contributor Author

samdb commented Apr 7, 2020

ℹ️ Shift updated your session.php configuration file to have a fallback value of null for the secure option and a value of lax for the same_site option.

These are related to the underlying Symfony 5 updates. You may change them if you are familiar with these options.

@samdb
Copy link
Contributor Author

samdb commented Apr 7, 2020

⚠️ The MAIL_DRIVER environment variable was renamed in Laravel 7 to MAIL_MAILER in order to support multiple mail configurations.

Shift attempted to automation this change, but you should review any additional environment configuration and update to the new variable name.

@samdb
Copy link
Contributor Author

samdb commented Apr 7, 2020

⚠️ Shift upgraded the following configuration files by defaulting them. This often makes the changes easier to review and backfill any customizations which are not configurable through ENV variables.

If you have a lot of customizations, you may quickly undo this commit with git revert and make these config file changes manually.

  • config/auth.php

@samdb
Copy link
Contributor Author

samdb commented Apr 7, 2020

ℹ️ Shift updated your dependencies for Laravel 7. 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 7.

Watch dealing with dependencies for tips on handling package incompatibilities.

@samdb
Copy link
Contributor Author

samdb commented Apr 7, 2020

ℹ️ Laravel 7 removed some of the PHPUnit configuration in favor of the defaults. While this is not a required changed, it is a good opportunity to compare your phpunit.xml with the default Laravel 7 version to modernize your configuration.

@samdb
Copy link
Contributor Author

samdb commented Apr 7, 2020

⚠️ Laravel 7 uses a new date format when serializing models. The previous format was 2019-12-02 20:01:00. Now, dates are serialized using an ISO-8601 compatible date format of 2019-12-02T20:01:00.283041Z in UTC.

This does not affect how dates are stored. Only how they are serialized when using the toArray or toJson Eloquent methods.

If you need to preserve the previous format, you may override the serializeDate method on your model. Review the Date Serialization section of the Upgrade Guide for more details.

@samdb
Copy link
Contributor Author

samdb commented Apr 7, 2020

ℹ️ All of the underlying Symfony components used by Laravel have been upgraded to Symfony 5. If you are directly interacting with Symfony components, you should review the Symfony change log for additional changes.

@samdb
Copy link
Contributor Author

samdb commented Apr 7, 2020

ℹ️ Shift noticed you have additional namespaces in your application. You should consider using the Consolidate Namespaces Shift to simplify your namespaces into the default Laravel App namespace.

@samdb
Copy link
Contributor Author

samdb commented Apr 7, 2020

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

The following Shifts can ensure your app is fully upgraded and following the practices recommended by Laravel and the community:

  • Laravel Linter analyzes your codebase for potential opportunities to do things "The Laravel Way".
  • Laravel Fixer automates many of the suggestions found by the Linter and other Shifts.
  • Upgrade Checker ensures your application is fully upgraded by detecting any outdated code.

In addition, stay upgraded forever as well as run these Shifts by subscribing to one of the new Shifty Plans.

@johannac johannac added the maintenance Maintenance and upgrades of code or dependencies label Apr 20, 2020
@justynpride
Copy link
Contributor

Would love to know if there us a time frame for moving to Laravel 7, and where things are at? What is needed to help complete this that we can help with?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Maintenance and upgrades of code or dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants