TechnicPack / TechnicSolder

PHP web app that brings differential updates to the Technic Launcher and Technic Platform
https://docs.solder.io/
Other
169 stars 167 forks source link

Laravel 8.x Shift #702

Closed Pyker closed 2 years ago

Pyker commented 2 years ago

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

Before merging, you need to:

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.

Pyker commented 2 years ago

:information_source: 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.

Pyker commented 2 years ago

:x: 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.

Pyker commented 2 years ago

:information_source: 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.

Pyker commented 2 years ago

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

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

php artisan make:migration AddUuidToFailedJobsTable

Then copy and paste the contents from Shift's AddUuidToFailedJobsTable class to add the uuid column and generate UUIDs for your existing failed jobs.

Pyker commented 2 years ago

:information_source: Laravel 8 added new ENV variables for AWS_USE_PATH_STYLE_ENDPOINT, FILESYSTEM_DRIVER, LOG_LEVEL, and LOG_DEPRECATIONS_CHANNEL. While these are defaulted within their respective configuration file, you may take this opportunity to set them accordingly for your environments.

Pyker commented 2 years ago

:warning: Shift upgraded your configuration files by defaulting them and merging your true customizations. These include values which are not changeable through core ENV variables.

You should review this commit for additional customizations or opportunities to use new ENV variables. If you have a lot of customizations, you may undo this commit with git revert 3335d27f and make the config file changes manually.

Pyker commented 2 years ago

:warning: Laravel 8 has removed the token driver from the API authentication. This driver was not very robust and was removed from the documentation. Laravel now recommends using Sanctum.

If you were using the token driver, you may re-add it within your auth.php configuration file, then migrate to Sanctum at your convenience.

Pyker commented 2 years ago

:information_source: 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 any additional package incompatibilities.

Pyker commented 2 years ago

:warning: 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.

Pyker commented 2 years ago

:information_source: Laravel 8 reintroduced the app/Models folder by default. This is an optional change. Laravel and the artisan commands will automatically detect if you are using the app/Models folder or not.

If you wish to modernize your application to use the app/Models folder, you may run the Namespace Models Shift for free.

Pyker commented 2 years ago

:information_source: Laravel 8 supports running your PHPUnit tests in parallel. Depending on your system, this may decrease run times as much as 70%.

To run your tests in parallel, you may use the php artisan test --parallel command, or use the underlying vendor/bin/paratest runner.