Skip to content

Laravel 13.x Shift#87

Open
MGeurts wants to merge 14 commits intomainfrom
shift-169706
Open

Laravel 13.x Shift#87
MGeurts wants to merge 14 commits intomainfrom
shift-169706

Conversation

@MGeurts
Copy link
Copy Markdown
Owner

@MGeurts MGeurts commented Mar 23, 2026

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

Before merging, you need to:

  • Checkout the shift-169706 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 get stuck, never hesitate to email support. If you need more help with your upgrade, check out the Human Shifts.

@MGeurts
Copy link
Copy Markdown
Owner Author

MGeurts commented Mar 23, 2026

ℹ️ 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 lang:publish --force to get the latest configuration files from Laravel, then reapplying the customizations Shift streamlined.

@MGeurts
Copy link
Copy Markdown
Owner Author

MGeurts commented Mar 23, 2026

ℹ️ Laravel 13 introduced dozens of new PHP attributes. Shift automated the adoption of these PHP attributes for Laravel class properties with simple values. However, there are additional attributes which you may adopt that contain potentially long values. For example, adopting the #[Fillable] or #[Guarded] attributes for model array properties.

 ✨ Automate more with AI...

Shift automates the changes it determines are reliable. If you want to push this automation further, you may paste the following prompt into your AI of choice:

I'm upgrading to Laravel 13. Laravel introduced new PHP attributes you may use
instead of class properties. Please adopt the `#[Fillable]` or `#[Guarded]`
attributes for any model array properties. Make sure to collapse any multiline
arrays into a single line for valid PHP attributes.

@MGeurts
Copy link
Copy Markdown
Owner Author

MGeurts commented Mar 23, 2026

⚠️ 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 42bea636 and make the config file changes manually.

@MGeurts
Copy link
Copy Markdown
Owner Author

MGeurts commented Mar 23, 2026

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

DB_CONNECTION=mysql
DB_DATABASE=genealogy
SESSION_SECURE_COOKIE=true

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.

1 similar comment
@MGeurts
Copy link
Copy Markdown
Owner Author

MGeurts commented Mar 23, 2026

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

DB_CONNECTION=mysql
DB_DATABASE=genealogy
SESSION_SECURE_COOKIE=true

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.

@MGeurts
Copy link
Copy Markdown
Owner Author

MGeurts commented Mar 23, 2026

⚠️ The default values for CACHE_PREFIX, REDIS_PREFIX, and SESSION_COOKIE changed in Laravel 13. If you are not setting these values explicitly, this change could cause cache or session invalidation after upgrading. As these defaults have changed a few times in recent Laravel versions, Shift recommends explicitly setting these ENV variables in your environment to ensure consistent behavior when upgrading.

 ✨ Automate more with AI...

Shift automates the changes it determines are reliable. If you want to push this automation further, you may paste the following prompt into your AI of choice:

I'm upgrading to Laravel 13. The default values for `CACHE_PREFIX`,
`REDIS_PREFIX`, and `SESSION_COOKIE` have changed. In Laravel 12 and earlier,
these were derived from `APP_NAME` using `Str::slug(env('APP_NAME', 'laravel'),
'_')` as a base (e.g. `myapp_cache_`, `myapp_database_`, `myapp_session`).
Please check my config files and `.env` to determine if these are explicitly set
or relying on the old defaults. If relying on defaults, suggest the explicit
values I should add to my `.env` to preserve the previous behavior.

@MGeurts
Copy link
Copy Markdown
Owner Author

MGeurts commented Mar 23, 2026

⚠️ The default cache configuration now includes a serializable_classes option set to false. This hardens cache unserialization behavior to help prevent PHP deserialization attacks. If your application stores PHP objects in cache, you should update this value to an array of the classes that may be unserialized.

 ✨ Automate more with AI...

Shift automates the changes it determines are reliable. If you want to push this automation further, you may paste the following prompt into your AI of choice:

I'm upgrading to Laravel 13. The default cache configuration now includes a
`serializable_classes` option set to `false` to prevent PHP deserialization
attacks. Please search my codebase for any code that stores PHP objects in the
cache (e.g. using `Cache::put()`, `cache()`, or `remember()` with object
values). If found, identify the classes being cached and suggest the explicit
list of classes I should set for the `serializable_classes` option in
`config/cache.php`.

@MGeurts
Copy link
Copy Markdown
Owner Author

MGeurts commented Mar 23, 2026

⚠️ The following environment variables have been renamed. Shift did not find these variables referenced in your committed files, but you should review any additional locations where your environment is configured and update to the new variable name.

 ✨ Automate more with AI...

Shift automates the changes it determines are reliable. If you want to push this automation further, you may paste the following prompt into your AI of choice:

I'm upgrading to Laravel 13. Several environment variables have been renamed.
Please search my codebase for any remaining references to the old variable names
and update them to the new names, including in any deployment scripts, CI
configuration, and documentation.

- `POSTMARK_TOKEN` to `POSTMARK_API_KEY`
- `RESEND_KEY` to `RESEND_API_KEY`

  • POSTMARK_TOKEN to POSTMARK_API_KEY
  • RESEND_KEY to RESEND_API_KEY

@MGeurts
Copy link
Copy Markdown
Owner Author

MGeurts commented Mar 23, 2026

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

The following dependencies were not updated by Shift and may be incompatible. If Composer lists one of these packages as a problem, you should check for a newer version.

@MGeurts
Copy link
Copy Markdown
Owner Author

MGeurts commented Mar 23, 2026

⚠️ Laravel 13 now throws a LogicException if you attempt to create new instances or register observer events while booting models. Instead, you must wrap this code within a whenBooted callback.

For example:

static::whenBooted(fn () => static::observe(new ModelObserver));

Shift found boot methods within the following files. You should review the code within these methods and update it to use the whenBooted callback if necessary.

 ✨ Automate more with AI...

Shift automates the changes it determines are reliable. If you want to push this automation further, you may paste the following prompt into your AI of choice:

I'm upgrading to Laravel 13. Calling `observe` while a model is still booting is
now disallowed and will throw a `LogicException`. Any `observe` calls within
`boot` methods must be wrapped in a `whenBooted` callback. For example:
`static::whenBooted(fn () => static::observe(new ModelObserver));`. Please
review the `boot` methods in the following files and wrap any observer
registration in `whenBooted`. Also, identify any `new Model()` instantiation
within `boot` methods and note these may also need to be moved or deferred, but
the appropriate fix will depend on their context.

- app/Models/User.php

@MGeurts
Copy link
Copy Markdown
Owner Author

MGeurts commented Mar 23, 2026

ℹ️ Laravel added a composer run dev script which starts php artisan serve, php artisan queue:listen --tries=1, php artisan pail, and npm run dev all in one command.

Shift added this script, as well as the necessary packages. Once you run composer update and npm install, you will be able to use the new composer run dev script.

@MGeurts
Copy link
Copy Markdown
Owner Author

MGeurts commented Mar 23, 2026

ℹ️ Laravel added a composer run setup script which runs commands like composer install, npm install, and others to set up your Laravel application. For convenience, Shift added the default script. You are encouraged to customize this script for your project.

@MGeurts
Copy link
Copy Markdown
Owner Author

MGeurts commented Mar 23, 2026

ℹ️ Laravel added a composer run test script which runs the new php artisan config:clear command, then php artisan test. For convenience, Shift added the default script. You are welcome to customize this script for your test suite.

@MGeurts
Copy link
Copy Markdown
Owner Author

MGeurts commented Mar 23, 2026

ℹ️ Laravel added an index to the expiration column of the caching tables. Shift did not detect this index, so it created a migration to add it. If this index is missing, you may run this migration with php artisan migrate to add it. Otherwise, you may delete this migration.

@MGeurts
Copy link
Copy Markdown
Owner Author

MGeurts commented Mar 23, 2026

ℹ️ Laravel 13 changed the password reset mail subject from "Reset Password Notification" to "Reset your password". If your application relied on the previous subject, for example in custom translation messages, you should update them accordingly.

@MGeurts
Copy link
Copy Markdown
Owner Author

MGeurts commented Mar 23, 2026

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

Next, you may optionally run the following Shifts to ensure your application is fully upgraded, adopts the latest Laravel conventions, and easier to maintain in the future:

  • Laravel Fixer automatically updates your code to the latest Laravel conventions.
  • Tests Generator intelligently generates model factories, HTTP Tests, and configuration for your application.
  • CI Generator intelligently generates CI jobs to lint PHP, check code style, and run tests, including Dusk.

You may also use the Shift Workbench to automate common tasks for maintaining your Laravel application.

Copy link
Copy Markdown
Owner Author

@MGeurts MGeurts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

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