Skip to content

Laravel 12.x Shift#576

Open
thekevinm wants to merge 13 commits intomasterfrom
shift-173252
Open

Laravel 12.x Shift#576
thekevinm wants to merge 13 commits intomasterfrom
shift-173252

Conversation

@thekevinm
Copy link
Copy Markdown
Contributor

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

Before merging, you need to:

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

Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions.

You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root.

For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
In an effort to make upgrading the constantly changing config files easier, Shift defaulted them and merged your true customizations - where ENV variables may not be used.
@thekevinm
Copy link
Copy Markdown
Contributor Author

⚠️ Shift detected a custom namespace. Laravel now recommends keeping the default App namespace. Unfortunately the app:name command was removed in Laravel 6.0. However, for the most part you may do a simple search and replace to change the namespace.

Shift recommends changing this to align with the latest Laravel conventions and improve Shift's automation. After doing so, you may request a rerun of this Shift.

@thekevinm
Copy link
Copy Markdown
Contributor Author

⚠️ Laravel 12 no longer inherits middleware from parent controllers. Shift detected the following controllers which use middleware and extend another controller. You should review these controllers to ensure they did not rely upon middleware from their parent controller. If they do, you may merge the parent controller's middleware, or simply copy the middleware into the child controller.

 ✨ 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 12. Middleware is no longer inherited from parent
controllers. Please review the following controllers to determine if they relied
on middleware defined in a parent controller. If so, add the missing middleware
directly to each child controller.

- app/Http/Controllers/Auth/ForgotPasswordController.php
- app/Http/Controllers/Auth/LoginController.php
- app/Http/Controllers/Auth/RegisterController.php
- app/Http/Controllers/Auth/ResetPasswordController.php

  • app/Http/Controllers/Auth/ForgotPasswordController.php
  • app/Http/Controllers/Auth/LoginController.php
  • app/Http/Controllers/Auth/RegisterController.php
  • app/Http/Controllers/Auth/ResetPasswordController.php

@thekevinm
Copy link
Copy Markdown
Contributor Author

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

@thekevinm
Copy link
Copy Markdown
Contributor 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.

CACHE_PREFIX=laravel
CACHE_STORE=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.

@thekevinm
Copy link
Copy Markdown
Contributor Author

ℹ️ Shift detected your application uses custom ENV variables for configuration options which have ENV variables in Laravel. Shift recommends renaming the following variables to use the one provided by Laravel:

  • CACHE_HOST to MEMCACHED_HOST
  • CACHE_PERSISTENT_ID to MEMCACHED_PERSISTENT_ID
  • CACHE_PORT to MEMCACHED_PORT

@thekevinm
Copy link
Copy Markdown
Contributor Author

ℹ️ Laravel 12 removed the MAIL_ENCRYPTION environment variable. While a new MAIL_SCHEME environment variable was introduced, its available options are not the same. Your application will likely behave correctly with the new default values. However, if you were setting MAIL_ENCRYPTION to tls, you may want to review this Mastering Laravel Tip for more details.

@thekevinm
Copy link
Copy Markdown
Contributor Author

⚠️ Laravel 12 changed the default values of the CACHE_PREFIX, REDIS_PREFIX, and SESSION_COOKIE to use dashes (-) instead of underscores (_). If you were not explicitly setting these environment variables, your application will use these new default values - which may result in unexpected behavior. For example, temporary cache misses or forced log out.

If your application uses cache prefixes or session cookies and you were not explicitly setting these ENVs, you may set them to their previous defaults to avoid any unexpected behavior.

@thekevinm
Copy link
Copy Markdown
Contributor Author

⚠️ Laravel 12 removed the APP_TIMEZONE environment variable. The timezone now defaults to UTC. Shift removed this variable from your .env file since it was set to UTC.

Shift detected additional references to the APP_TIMEZONE environment variable in the following files. You should remove the environment variable and, if necessary, reference the app.timezone configuration option instead.

  • installer.sh

@thekevinm
Copy link
Copy Markdown
Contributor Author

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

@thekevinm
Copy link
Copy Markdown
Contributor Author

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

@thekevinm
Copy link
Copy Markdown
Contributor Author

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

@thekevinm
Copy link
Copy Markdown
Contributor Author

ℹ️ In a minor release of Laravel 11, the local storage disk was updated to use the storage/app/private folder. This keeps files organized within a subfolder, similar to the public disk.

Shift added the storage/app/private folder. However, to avoid potentially breaking your app, Shift did not change your configuration. If you want, you may migrate your files and update your local disk path in your config/filesystems.php file. If you are not using the local storage disk, you may go ahead and update the path.

@thekevinm
Copy link
Copy Markdown
Contributor Author

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

The following dependencies are now abandoned. You will need to remove or replace them to complete your upgrade.

@thekevinm
Copy link
Copy Markdown
Contributor Author

ℹ️ If you are using laravel new to create new Laravel applications, you should update to the latest version to receive updates for Laravel 12 and the new starter kits.

You may update the Laravel installer by running:

composer global require laravel/installer

@thekevinm
Copy link
Copy Markdown
Contributor Author

⚠️ Laravel 12 no longer includes the SVG image type when performing image validation. If your application allows SVG images, you should review your image validation rules and update them to use the new allow_svg option.

'cover' => ['required', 'image:allow_svg'],
'avatar' => ['required', File::image(allowSvg: true)],

@thekevinm
Copy link
Copy Markdown
Contributor Author

ℹ️ The container now respects the default value of constructor parameters when resolving a class instance. If you were previously relying on the container to set a value, you will need to pass in this value when resolving the class instead.

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