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 11.x Shift #514

Merged
merged 46 commits into from
Dec 13, 2024
Merged

Laravel 11.x Shift #514

merged 46 commits into from
Dec 13, 2024

Conversation

andrewmile
Copy link
Collaborator

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

Before merging, you need to:

  • Checkout the shift-124743 branch
  • Review all pull request comments for additional changes
  • Run composer update (if the scripts fail, try with --no-scripts)
  • Clear any config, route, or view cache
  • Thoroughly test your application (no tests?, no CI?)

If you need help with your upgrade, check out the Human Shifts.

@andrewmile
Copy link
Collaborator Author

ℹ️ To slim down the Laravel installation, Laravel 11 no longer has most of the core files previously included in the default Laravel application. While you are welcome to publish and customize these files, they are no longer required.

Shift takes an iterative approach to removing core files which are not customized or where its customizations may be done elsewhere in a modern Laravel 11 application. As such, you may see some commits removing files and others re-registering your customizations.

@andrewmile
Copy link
Collaborator Author

ℹ️ Starting with Laravel 10, the lang folder is no longer included in a default Laravel application. Laravel now recursively merges any customizations with framework defaults.

Shift streamlined your language files by removing options that matched the Laravel defaults and preserving your customizations. If you wish to keep the full set of language, Shift recommends running artisan config:publish --all --force to get the latest configuration files from Laravel 11, then reapplying the customizations Shift streamlined.

@andrewmile
Copy link
Collaborator Author

⚠️ The application bootstrapping changed in Laravel 11. As a result, files like artisan and public/index.php were rewritten. Shift overwrote these files but detected yours may have contained customizations. You should review the diff to see if any of your customizations are still needed.

@andrewmile
Copy link
Collaborator Author

andrewmile commented Jul 19, 2024

❌ 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 11 versions and merge any changes:

  • lang/en/validation.php

@andrewmile
Copy link
Collaborator Author

ℹ️ Laravel 11 no longer requires you to maintain the default configuration files. Your configuration now merges with framework defaults.

Shift streamlined your configuration files by removing options that matched the Laravel defaults and preserving your true customizations. These are values which are not changeable through ENV variables.

If you wish to keep the full set of configuration files, Shift recommends running artisan config:publish --all --force to get the latest configuration files from Laravel 11, then reapplying the customizations Shift streamlined.

@andrewmile
Copy link
Collaborator Author

ℹ️ Shift detected customized options within your configuration files which may be set with an ENV variable. To help keep your configuration files streamlined, you may set the following variables. Be sure adjust any values per environment.

APP_KEY=YourSecretKey!!!
APP_NAME=Symposium
APP_TIMEZONE=America/Detroit
BCRYPT_ROUNDS=10
CACHE_STORE=file
DB_CONNECTION=mysql
FILESYSTEM_DISK=public
LOG_DAILY_DAYS=7
LOG_STACK=daily,bugsnag
MAIL_FROM_ADDRESS=noreply@symposiumapp.com
MAIL_FROM_NAME=Symposium
MAIL_MAILER=smtp
QUEUE_CONNECTION=sync
REDIS_CLIENT=predis
REDIS_CLUSTER=predis
SESSION_DRIVER=file

Note: some of these may simply be values which changed between Laravel versions. You may ignore any ENV variables you do not need to customize.

@andrewmile
Copy link
Collaborator Author

⚠️ The BROADCAST_DRIVER, CACHE_DRIVER, and DATABASE_URL environment variables were renamed in Laravel 11 to BROADCAST_CONNECTION, CACHE_STORE, and DB_URL, respectively.

Shift automated this change for your committed files, but you should review any additional locations where your environment is configured and update to the new variable names.

@andrewmile
Copy link
Collaborator Author

❌ The bootstrap/app.php file has been completely rewritten in Laravel 11 to allow configuring your Laravel application in a single location. Shift overwrote your file, but detected it may have contained customizations. You should review the diff to see if any of your customizations are still needed.

@andrewmile
Copy link
Collaborator Author

⚠️ Laravel 11 automatically discovers policies scanning your application's Policies directory at or above the directory containing your models.

Shift detected policies registered with the policies property of your AuthServiceProvider. If any of these policies can not be automatically discovered, you may register them manually using Gate::policy() in your AppServiceProvider.

@andrewmile
Copy link
Collaborator Author

⚠️ Shift was unable to re-register your exception handler. You may review the documentation to do so manually, or register your original exception handler by adding the following binding to the register method of your AppServiceProvider:

$this->app->bind(\Illuminate\Contracts\Debug\ExceptionHandler::class, \App\Exceptions\Handler::class);

@andrewmile
Copy link
Collaborator Author

❌ Shift detected you are using laravelcollective/html. This package has been abandoned. They suggest using the spatie/laravel-html package instead. You may use Shift's HTML Converter to automate this conversion. However, if you are not using the laravelcollective/html package extensively, you may simply rewrite its uses to raw HTML.

@andrewmile
Copy link
Collaborator Author

andrewmile commented Jul 19, 2024

ℹ️ Shift updated your dependencies for Laravel 11. 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 11. Watch dealing with dependencies for tips on handling any Composer issues.

The following dependencies were updated by a major version and may have their own changes. You may check their changelog for any additional upgrade steps.

@andrewmile
Copy link
Collaborator Author

ℹ️ The base Controller class has been marked as abstract in Laravel 11, with its traits and inheritance removed. This is to prevent using this base controller directly and to use facades instead of the trait methods.

Shift detected your base controller did not have any public methods, so it was safe to mark as abstract. However, since you may be using trait methods within your controllers, Shift did not remove them. If you know you are not using any trait methods or want to refactor to facades, you may remove them manually.

@andrewmile
Copy link
Collaborator Author

andrewmile commented Jul 19, 2024

❌ Laravel 11 has removed its dependency on doctrine/dbal. As such, all of Laravel's classes and methods related Doctrine DBAL have been removed.

Shift detected potential uses of these within the following files. You should review these instances and, if they are still needed, reference the Upgrade Guide for native alternatives.

  • database/migrations/2022_07_18_143158_change_encoding_and_collation_to_utf8mb4.php

@andrewmile
Copy link
Collaborator Author

⚠️ In Laravel 11, changing a column now requires you to include all the modifiers you want to keep on the column definition after it is changed. Any missing attributes will be dropped. This change may cause unexpected behavior if you were to run pending or old migrations.

Shift detected potential uses of the change method within your migrations. While you may go back and update these migrations, you may wish to simply squash your old migrations. This will not only avoid rework, but may also improve the performance of your test suite.

@andrewmile
Copy link
Collaborator Author

⚠️ Many first-party Laravel packages no longer load their migrations automatically. Instead, you may need to publish their migrations to your application if you have not already done so. Shift detected you are using Passport. You may run the following command to publish their migrations:

php artisan vendor:publish --tag=passport-migrations

@andrewmile andrewmile self-assigned this Oct 12, 2024
@andrewmile andrewmile merged commit 5239970 into develop Dec 13, 2024
2 checks passed
@andrewmile andrewmile deleted the shift-124743 branch December 13, 2024 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants