Using Laravel Shift to upgrade your application has several advantages over manually creating a new Laravel project and migrating your code. Here's why you might consider using Laravel Shift:
-
Automated Process: Laravel Shift automates the upgrade process by applying the official Laravel upgrade guide. It performs many of the upgrade tasks automatically, which can save you a significant amount of time and reduce the risk of human error.
-
Custom Upgrade Steps: Shift tailors the upgrade process to your application by detecting your specific version and applying the necessary incremental changes. This means it can handle customizations and packages that you might have added to your application.
-
Detailed Pull Request: After the upgrade, Shift provides a detailed pull request that outlines every change. This allows you to review the changes, understand what was done, and make any necessary adjustments.
-
Compatibility Checks: Shift checks for compatibility issues with your current packages and can help you upgrade those packages to versions compatible with the new Laravel version.
-
Time-Saving: Manually upgrading can be time-consuming, especially if you're not familiar with all the changes introduced in the new Laravel version. Shift does the heavy lifting for you, allowing you to focus on other aspects of your application.
Regarding your concerns:
-
Laravel/ui and Bootstrap: You can continue using Laravel/ui and Bootstrap in Laravel 11. Laravel Breeze and other starter kits are optional, and you are not forced to use them.
-
Laravel Mix and Vite: Laravel 9 introduced Vite as the default build tool, but you are not required to use it. You can continue using Laravel Mix if that's your preference. You would need to manually configure your project to use Mix instead of Vite, but this is a one-time setup.
Here's a basic guide on how to revert to using Laravel Mix if your new Laravel project is set up with Vite:
- Remove Vite-related dependencies:
npm uninstall vite laravel-vite-plugin
- Install Laravel Mix:
npm install laravel-mix --save-dev
- Add a
webpack.mix.jsfile to your project root with your desired configuration. Here's a basic example:
const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js')
.postCss('resources/css/app.css', 'public/css', [
//
]);
- Update your
package.jsonscripts to use Mix commands:
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix hot",
"prod": "npm run production",
"production": "mix --production"
}
- Run
npm installand thennpm run devto compile your assets.
Remember to remove any Vite-specific configuration from your resources/views if it exists.
In conclusion, while you can manually upgrade your Laravel application, using Laravel Shift can streamline the process and help you avoid potential pitfalls. If you prefer to stick with Laravel Mix and Bootstrap, you can certainly do so, and you're not obligated to switch to Vite or Breeze.