Skip to content

Conversation

driesvints
Copy link
Member

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

Before merging, you need to:

  • Checkout the shift-24472 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.

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.
@driesvints
Copy link
Member Author

⚠️ Laravel 7 adds CORS middleware and defaults the middlewarePriority internally so you only need to overwrite this property for customizations.

Shift attempted to automate these changes. But you should compare your app/Http/Kernel.php with the default Laravel 7 version to finalize any changes.

@driesvints
Copy link
Member Author

ℹ️ 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.

@driesvints
Copy link
Member Author

ℹ️ 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.

@driesvints
Copy link
Member Author

ℹ️ 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.

@driesvints
Copy link
Member Author

❌ The MAIL_DRIVER environment variable was renamed in Laravel 7 to MAIL_MAILER in order to support multiple mail configurations. Be sure to update any environment configuration to reflect the new variable name.

@driesvints
Copy link
Member Author

driesvints commented Mar 11, 2020

⚠️ Shift upgraded the following configuration files by defaulting them and then attempting to backfill true customizations. You should review these changes for any additional customizations you require which aren't configurable through ENV variables. If you have a lot of customizations, you may quickly undo this commit with git revert and upgrade these files manually.

  • config/logging.php
  • config/mail.php

@driesvints
Copy link
Member Author

ℹ️ 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.

@driesvints
Copy link
Member Author

ℹ️ 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.

@driesvints
Copy link
Member Author

driesvints commented Mar 11, 2020

⚠️ In Laravel 7, the assertSee and assertDontSee assertions automatically escape the expected values.

If you were manually escaping the values passed to these assertions, you no longer need do so. If you were asserting values containing HTML that should not be escaped, you may set the new escaped argument to false.

Shift found the instances of these assertions within:

  • tests/Feature/DashboardTest.php
  • tests/Feature/ForumTest.php
  • tests/Feature/NavigationTest.php

@driesvints
Copy link
Member Author

⚠️ 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.

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.

@driesvints
Copy link
Member Author

ℹ️ 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.

@driesvints
Copy link
Member Author

ℹ️ The deprecated --daemon flag on the queue:work command has been removed. In Laravel 7, the worker runs as a daemon by default. If you were using this flag, you may remove it.

@driesvints
Copy link
Member Author

ℹ️ Shift detected you are using a Laravel package like Horizon, Nova, Spark, etc which has its own assets which may need to be 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 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.

@driesvints driesvints mentioned this pull request Mar 11, 2020
@driesvints driesvints closed this Apr 2, 2020
@driesvints driesvints deleted the shift-24472 branch April 2, 2020 19:21
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.

2 participants