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

(Shift) Laravel 12.x.x #4500

Open
wants to merge 32 commits into
base: development
Choose a base branch
from
Open

(Shift) Laravel 12.x.x #4500

wants to merge 32 commits into from

Conversation

HDVinnie
Copy link
Collaborator

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

Before merging, you need to:

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

PHP 5.5.9 adds the new static `class` property which provides the fully qualified class name. This is preferred over using strings for class names since the `class` property references are checked by PHP.
Accessing Faker properties was deprecated in Faker 1.14.
Laravel 8 adopts the tuple syntax for controller actions. Since the old options array is incompatible with this syntax, Shift converted them to use modern, fluent methods.
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.
@HDVinnie
Copy link
Collaborator Author

⚠️ Shift detected you have not adopted the new application configuration and streamlined structure available in Laravel 11. While your legacy application may still run on Laravel 12, you may use the Laravel Slimmer to automate these changes. Doing so will no only slim your codebase, but allow you to follow the latest conventions from the documentation.

After running the Laravel Slimmer, you may email support to rerun this Shift.

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

@HDVinnie
Copy link
Collaborator 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 a802ca2a and make the config file changes manually.

@HDVinnie
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.

CACHE_STORE=file
DB_CONNECTION=mysql
DB_DATABASE=forge
DB_USERNAME=forge

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.

@HDVinnie
Copy link
Collaborator 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:

  • DATABASE_URL to DB_URL

@HDVinnie
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.

CACHE_STORE=file
DB_CONNECTION=mysql
DB_DATABASE=forge
DB_USERNAME=forge

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.

@HDVinnie
Copy link
Collaborator 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:

  • DATABASE_URL to DB_URL

@HDVinnie
Copy link
Collaborator Author

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

@HDVinnie
Copy link
Collaborator 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 has 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.

@HDVinnie
Copy link
Collaborator 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.

@HDVinnie
Copy link
Collaborator Author

ℹ️ Starting with Laravel 11, guzzlehttp/guzzle is included as a framework dependency. Since Shift did not detect any references to the GuzzleHttp namespace within your application it removed your direct dependency.

@HDVinnie
Copy link
Collaborator 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 updated by a major version and may have their own changes. You may check their changelog for any additional upgrade steps.

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.

@HDVinnie
Copy link
Collaborator Author

ℹ️ Laravel renamed the password_resets table to password_reset_tokens. While an optional change, Shift detected you have a migration for the original table and created a migration to rename the table. You should check for any additional references to the password_resets table and run php artisan migrate to complete your upgrade.

@HDVinnie
Copy link
Collaborator Author

⚠️ Laravel 10 has added a return type of array to the Event broadcastOn and Notification via methods. However, you may still return a single channel from these methods.

Shift added the array return type to these methods in the following classes. You should review them to ensure you are returning an array, or remove the return type.

  • app/Notifications/FailedLogin.php
  • app/Notifications/MassEmail.php
  • app/Notifications/NewBon.php
  • app/Notifications/NewComment.php
  • app/Notifications/NewCommentTag.php
  • app/Notifications/NewFollow.php
  • app/Notifications/NewPost.php
  • app/Notifications/NewPostTag.php
  • app/Notifications/NewPostTip.php
  • app/Notifications/NewRequestBounty.php
  • app/Notifications/NewRequestClaim.php
  • app/Notifications/NewRequestFill.php
  • app/Notifications/NewRequestFillApprove.php
  • app/Notifications/NewRequestFillReject.php
  • app/Notifications/NewRequestUnclaim.php
  • app/Notifications/NewReseedRequest.php
  • app/Notifications/NewThank.php
  • app/Notifications/NewTopic.php
  • app/Notifications/NewUnfollow.php
  • app/Notifications/NewUpload.php
  • app/Notifications/NewUploadTip.php
  • app/Notifications/NewWishListNotice.php
  • app/Notifications/StaffCommentCreated.php
  • app/Notifications/StaffTicketAssigned.php
  • app/Notifications/StaffTicketClosed.php
  • app/Notifications/StaffTicketCreated.php
  • app/Notifications/UserBan.php
  • app/Notifications/UserBanExpire.php
  • app/Notifications/UserCommentCreated.php
  • app/Notifications/UserEmailChange.php
  • app/Notifications/UserManualWarningExpire.php
  • app/Notifications/UserMaxWarningsReached.php
  • app/Notifications/UserPreWarning.php
  • app/Notifications/UserTicketAssigned.php
  • app/Notifications/UserTicketClosed.php
  • app/Notifications/UserTicketCreated.php
  • app/Notifications/UserTicketStale.php
  • app/Notifications/UserWarning.php
  • app/Notifications/UserWarningExpire.php

@HDVinnie
Copy link
Collaborator Author

ℹ️ Starting with Laravel 10, PHP type hints were added within classes included in a Laravel application. In an effort to modernize your code, Shift automated this change where Laravel strictly specifies a type. If you prefer not to type hint your code you may revert this commit by running: git revert 27f9fe4d

@HDVinnie
Copy link
Collaborator Author

❌ Laravel 12 has a nesbot/carbon dependency of ^3.0. Although Laravel 11 supported Carbon 3.0, Shift detected you set an explicit constraint for Carbon 2. Carbon 3 made some breaking changes. Most notably to the diffIn* methods and the removal of the setUtf8, formatLocalized, setWeekStartsAt, setWeekEndsAt methods.

You should review the Carbon migration notes for more details, but to help guide your changes, Shift found uses of these changed methods in the following files:

@HDVinnie
Copy link
Collaborator Author

ℹ️ All of the underlying Symfony components used by Laravel have been upgraded to Symfony 7.2. Shift detected references to Symfony classes within your application. These are most likely type hints and can safely be ignored. If you are using Symfony classes directly or experience issues relating to Symfony, you should review the Symfony change log for any additional changes.

@HDVinnie
Copy link
Collaborator Author

⚠️ Shift detected your application is using Pest. To provide you with a compatible set of dependencies, Shift bumped your version of Pest to 3.x. While your test suite may still run, you are encouraged to review their Upgrade Guide to ensure your test suite is fully upgraded.

@HDVinnie
Copy link
Collaborator Author

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

You may update your installer by running:

composer global require laravel/installer

@HDVinnie
Copy link
Collaborator 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)],

@HDVinnie
Copy link
Collaborator Author

🎉 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.

@HDVinnie HDVinnie changed the title Laravel 12.x Shift (Shift) Laravel 12.x.x Feb 25, 2025
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.

3 participants