Great question! This is a common point of confusion when upgrading Laravel applications.
Short Answer:
Yes, you should review and consider merging relevant changes from the new Laravel version’s config and stub files into your existing application, but you should do so carefully and manually.
Explanation:
-
Laravel Upgrade Process:
When you upgrade Laravel (e.g., from v10 → v11 → v12), Composer only updates the files in thevendor/directory. Your application files (like those inconfig/,app/, etc.) are not automatically updated or overwritten. This is by design, so your customizations are not lost. -
Why Are There Differences?
Each new Laravel release may introduce changes to the default config files, stubs, or even structure. These are only present in new installations, not in upgraded projects. -
What Should You Do?
- Review the Laravel Upgrade Guide:
Each major release comes with an upgrade guide that lists required changes. Always follow this guide first. - Compare Files:
Use a tool like Laravel Shift's Workbench or a diff tool to compare your files with those from a fresh install. - Merge Carefully:
- For files like
config/app.php,config/auth.php, etc., manually merge in new options or settings as needed. - For files you have customized, be careful not to overwrite your changes.
- Some files may have new keys or improved defaults. Add these as appropriate.
- For files like
- Vendor Files:
Thevendor/laravel/frameworkfiles are updated by Composer. If you see differences here, ensure your Composer dependencies are up to date:
You should not manually edit files incomposer updatevendor/.
- Review the Laravel Upgrade Guide:
Summary Table:
| File Type | Automatically Updated? | Action Required? |
|---|---|---|
vendor/ |
Yes (via Composer) | No manual changes needed |
config/, app/ |
No | Manually review/merge |
Helpful Command:
To see what files have changed in your app after a fresh install, you can use:
git diff <your-branch> <fresh-install-branch>
Conclusion:
Always review and merge changes from new Laravel releases into your app’s config and stub files. This keeps your app up-to-date with new features, security patches, and best practices.
If you want an automated approach, consider using Laravel Shift to handle upgrades and file merging for you.