-
-
Notifications
You must be signed in to change notification settings - Fork 254
Laravel 12.x Shift #2080
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
Laravel 12.x Shift #2080
Conversation
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.
|
ℹ️ Starting with Laravel 10, the 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 |
|
You should review this commit for additional customizations or opportunities to use new |
|
ℹ️ Shift detected customized options within your configuration files which may be set with an DB_DATABASE=panel
DB_USERNAME=pelican
REDIS_CLIENT=predisNote: some of these may simply be values which changed between Laravel versions. You may ignore any |
1 similar comment
|
ℹ️ Shift detected customized options within your configuration files which may be set with an DB_DATABASE=panel
DB_USERNAME=pelican
REDIS_CLIENT=predisNote: some of these may simply be values which changed between Laravel versions. You may ignore any |
|
ℹ️ Laravel 12 removed the |
|
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. |
|
❌ Laravel 12 removed the Shift detected references to the
|
|
ℹ️ Laravel added a Shift has added this script, as well as the necessary packages. Once you run |
|
ℹ️ Laravel added a |
|
ℹ️ Laravel added a |
|
ℹ️ 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. |
|
ℹ️ 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: |
|
ℹ️ 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. |
|
ℹ️ If you are using the Laravel installer CLI tool to create new Laravel applications with You may update your installer by running: composer global require laravel/installer |
|
'cover' => ['required', 'image:allow_svg'],
'avatar' => ['required', File::image(allowSvg: true)], |
|
❌ Several of the Shift detected potential uses of these methods in the following files. You should review these instances to see if you need to preserve the original behavior. You may review the documentation on Multi-Schema Database Inspecting for more information.
|
📝 WalkthroughWalkthroughThis PR updates Laravel framework to v12.45, refactors Eloquent scope declarations to use attribute-based syntax, updates database and mail configurations with new defaults and connection types, removes legacy authentication language entries, upgrades development dependencies, and adds test environment settings. Changes
Possibly related PRs
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
ℹ️ 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. |
|
🎉 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:
You may also use the Shift Workbench to automate common tasks for maintaining your Laravel application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
config/database.php (1)
5-10: Dead code: These variables are no longer used.Lines 5–10 define
$datapasePath(typo of$databasePath) and conditionally set$databasePath, but neither variable is referenced after line 44 was changed to useenv('DB_DATABASE', database_path('database.sqlite'))directly.🧹 Suggested fix: Remove unused code
<?php use Illuminate\Support\Str; -$database = env('DB_DATABASE', 'database.sqlite'); -$datapasePath = database_path($database); - -if (str_starts_with($database, '/') || $database === ':memory:') { - $databasePath = $database; -} - return [
🤖 Fix all issues with AI agents
In @config/database.php:
- Line 154: The change of the default Redis client to phpredis (see the config
entry 'client' => env('REDIS_CLIENT', 'phpredis') in config/database.php) can
break installs without the phpredis extension; update upgrade/migration notes to
call this out and either add guidance to set REDIS_CLIENT=predis in .env or add
a commented example line REDIS_CLIENT=predis to .env.example so users without
the extension know to revert to predis; ensure the docs mention commit 5331c5ab
and the composer dependency on predis (^2.3) for clarity.
In @package.json:
- Line 14: The package.json now pins "laravel-vite-plugin": "^2.0.0" which is
ESM-only and has breaking changes; update package.json and project config by
either downgrading the plugin or upgrading Vite and related plugins (vite,
@vitejs/*, vue/react plugins) to compatible majors, ensure your Node version
meets the new minimum, and modify vite.config.js (or rename to vite.config.cjs
if you must keep CommonJS) to address ESM requirements and the new server.https
shape (replace boolean server.https: true with an object form), verify any
default path changes (e.g., refresh/watch patterns like app/Livewire/**) and run
full dev and production builds to confirm no regressions.
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
app/Console/Commands/Overrides/ConfigCacheCommand.phpapp/Models/ActivityLog.phpcomposer.jsonconfig/database.phpconfig/mail.phplang/en/auth.phppackage.jsonphpunit.xml
🧰 Additional context used
🧬 Code graph analysis (1)
app/Models/ActivityLog.php (1)
app/Services/Activity/ActivityLogService.php (1)
actor(96-101)
🔇 Additional comments (15)
composer.json (2)
18-18: LGTM: Framework version bump looks safe.The bump from ^12.37 to ^12.45 is a patch-level upgrade within Laravel 12.x and should maintain backward compatibility.
87-105: The composer.json scripts are correctly structured.The
devscript is well-formed with concurrently (^9.0.1) already listed in package.json devDependencies, sonpxwill find it without requiring a global installation. The four color codes are valid hex format and match the four process names (server, queue, logs, vite). When you run this script, verify that the concurrent processes (Laravel server, queue listener, logs, and Vite dev server) start and stop cleanly together.config/mail.php (3)
52-52: Good defensive coding with string cast.Casting
APP_URLto string beforeparse_url()prevents potential type errors if the environment variable is unexpectedly null or non-string.
91-91: LGTM: Retry configuration improves resilience.Adding
retry_afterto failover and roundrobin mailers provides better handling of temporary mail delivery failures with a 60-second backoff.Also applies to: 100-100
45-45: No action needed on this line; the code is correct.The
'scheme' => env('MAIL_SCHEME')configuration correctly reads the environment variable for Laravel 12's mail scheme. Per Laravel 12 documentation,MAIL_SCHEMEacceptsnull(default STARTTLS on port 587),smtp, orsmtps(implicit TLS on port 465). If migrating fromMAIL_ENCRYPTION=tls, setMAIL_SCHEME=nullorMAIL_SCHEME=smtpsin your .env file—this is an environment configuration concern, not a code issue.Likely an incorrect or invalid review comment.
phpunit.xml (1)
19-19: LGTM: Test environment configuration additions.The new environment variables appropriately disable broadcasting and Nightwatch monitoring during test execution, preventing side effects and improving test isolation.
Also applies to: 29-29
app/Console/Commands/Overrides/ConfigCacheCommand.php (1)
12-12: Return type correctly matches Laravel 12.45 parent signature.The
voidreturn type on line 12 matches the parentIlluminate\Foundation\Console\ConfigCacheCommand::handle()method signature in Laravel 12.45.lang/en/auth.php (1)
16-21: LGTM — Custom authentication strings preserved correctly.The removal of
failed,password, andthrottleentries aligns with Laravel 12's approach where framework defaults are recursively merged at runtime. Your custom 2FA-related entries are preserved as expected.app/Models/ActivityLog.php (2)
11-11: LGTM — Import added for attribute-based scopes.
112-125: LGTM — Scopes correctly migrated to Laravel 12's attribute-based pattern.The
#[Scope]attribute registration withprotectedvisibility and unprefixed method names follows the new Laravel 12 convention. The existing PHPDoc@methodannotations on lines 41-42 remain accurate for IDE/static analysis support.config/database.php (5)
44-50: SQLite configuration updated with Laravel 12 defaults.The direct
env()call for the database path and newtransaction_modesetting are consistent with Laravel 12's defaults.
58-59: Default credentials changed from project-specific to Laravel defaults.The defaults changed from
panel/pelicantolaravel/root. Existing deployments should be unaffected ifDB_DATABASEandDB_USERNAMEare set in.env, but this could cause confusion for new installations following project-specific documentation.Per the PR comments, consider adding these to
.env.example:DB_DATABASE=panel DB_USERNAME=pelicanAlso applies to: 78-79, 98-99
108-121: New SQL Server connection added.Standard Laravel 12 addition. The commented
encryptandtrust_server_certificateoptions are appropriate for optional TLS configuration.
158-158: Redis prefix format changed.Changed from
_database_suffix to-database-suffix with(string)cast. Existing Redis data will become inaccessible under the new prefix after upgrade unlessREDIS_PREFIXis explicitly set to preserve the old format.
182-186: New Redis retry/backoff options added.Good resilience improvements with sensible defaults: 3 retries using decorrelated jitter backoff (100ms base, 1000ms cap). These are additive and shouldn't affect existing behavior.
Also applies to: 214-218
config/database.php
Outdated
| 'redis' => [ | ||
|
|
||
| 'client' => env('REDIS_CLIENT', 'predis'), | ||
| 'client' => env('REDIS_CLIENT', 'phpredis'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if predis is a required dependency in composer.json
rg -n '"predis' composer.json
# Check .env.example for REDIS_CLIENT setting
rg -n 'REDIS_CLIENT' .env.exampleRepository: pelican-dev/panel
Length of output: 96
🏁 Script executed:
#!/bin/bash
# Check if .env.example exists
ls -la .env* | head -20
# Read the config/database.php file around line 154 to see full context
cat -n config/database.php | sed -n '140,170p'
# Search for REDIS_CLIENT in all .env files
find . -name ".env*" -type f | xargs grep -l "REDIS_CLIENT" 2>/dev/null || echo "No REDIS_CLIENT found in .env files"Repository: pelican-dev/panel
Length of output: 1467
🏁 Script executed:
#!/bin/bash
# Read .env.example
cat -n .env.example
# Check git log for changes to config/database.php
git log --oneline config/database.php 2>/dev/null | head -10
# Show the last few commits mentioning REDIS or redis
git log --oneline --all 2>/dev/null | grep -i redis | head -10Repository: pelican-dev/panel
Length of output: 762
🏁 Script executed:
#!/bin/bash
# Show the change in commit 5331c5ab (when predis was set as default)
git show 5331c5ab --stat 2>/dev/null | head -20
# Show the current state more clearly
git diff 5331c5ab HEAD -- config/database.php 2>/dev/null | head -50Repository: pelican-dev/panel
Length of output: 2375
🏁 Script executed:
#!/bin/bash
# Show the exact change in the redis client line
git show 5331c5ab:config/database.php 2>/dev/null | grep -A 2 -B 2 "REDIS_CLIENT" | head -10
# Check what was before that commit
git show 5331c5ab~1:config/database.php 2>/dev/null | grep -A 2 -B 2 "REDIS_CLIENT" | head -10Repository: pelican-dev/panel
Length of output: 766
Document Redis client change in upgrade notes or provide migration guidance.
The default Redis client was changed from predis to phpredis in commit 5331c5a. While predis remains available as a dependency (^2.3 in composer.json), installations without the phpredis PHP extension installed will break unless REDIS_CLIENT=predis is explicitly set in .env.
This should be documented prominently in upgrade notes, or consider adding REDIS_CLIENT=predis to .env.example as a commented default to guide users through the transition.
🤖 Prompt for AI Agents
In @config/database.php at line 154, The change of the default Redis client to
phpredis (see the config entry 'client' => env('REDIS_CLIENT', 'phpredis') in
config/database.php) can break installs without the phpredis extension; update
upgrade/migration notes to call this out and either add guidance to set
REDIS_CLIENT=predis in .env or add a commented example line REDIS_CLIENT=predis
to .env.example so users without the extension know to revert to predis; ensure
the docs mention commit 5331c5ab and the composer dependency on predis (^2.3)
for clarity.
| "autoprefixer": "^10.4.21", | ||
| "concurrently": "^9.0.1", | ||
| "laravel-vite-plugin": "^1.0", | ||
| "laravel-vite-plugin": "^2.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
laravel-vite-plugin 2.0.0 breaking changes migration guide
💡 Result:
Short migration summary for laravel-vite-plugin → 2.0.0 and what to change
Sources: [1][2][3]
What changed (breaking / notable)
- Drops CJS build / ESM-first: plugin no longer ships a CommonJS build — projects must use ESM or .cjs config files. [2][1]
- Node.js support bumped / older Node removed: older Node (14/15/16/17/19, etc.) support removed — run on a supported Node for the Vite version you use. [2]
- server.https boolean removed: boolean value for vite.config server.https is no longer supported (use the object form or other TLS options). [2]
- Depend on matching Vite major: v2 of the plugin expects newer Vite/plugin versions — you must upgrade Vite and any Vite plugins (Vue/React plugins) to compatible versions. [2]
- Misc developer conveniences: new commands and default refresh/watch paths (e.g., app/Livewire/**) and SSR manifest output behaviour changed in prior major moves—check your refresh/watch settings if you rely on defaults. [2]
Minimum migration steps
- Update packages:
- npm install --save-dev vite@^ laravel-vite-plugin@^2.0.0 and update any @vitejs plugins to their matching compatible versions. Confirm exact Vite major required by your plugin release notes. [2][1]
- Make package.json ESM (if not already):
- npm pkg set type=module or keep CJS config files as .cjs when you must keep CommonJS in configs. [2]
- Update vite.config.*:
- Replace any server.https: true/false boolean with the supported object form or your TLS setup.
- Convert any require(...) usage in vite.config to ESM import, or rename file to vite.config.cjs and keep require. [2]
- Check Node version:
- Run on a Node version supported by the Vite major you installed (upgrade Node if needed). [2]
- Verify hot/hotFile and filesystem paths:
- If you use hotFile or hot-related features, confirm directories exist and plugin behaviour (hotFile path) after upgrade; some fixes were released after 2.0.0. [1][3]
- Test dev and build:
- Run dev server and production build; confirm manifest/SSR output and asset URLs used by your Laravel views still match (update blade calls if manifest structure or file names changed).
If you want, I can:
- fetch the exact Vite version compatibility and the plugin’s full changelog/upgrade guide (link to the plugin CHANGELOG / release notes) and produce a patch/diff for your vite.config and package.json. Which repo/version of Vite are you upgrading from?
Sources
[1] npm/jsDelivr package listing for laravel-vite-plugin (shows v2.0.0).
[2] Extracts from the plugin upgrade notes / changelog (noting CJS removal, server.https boolean removal, Node drops, and upgrade steps).
[3] Yarn/npm changelog entries and follow-up fixes referencing post-2.0.0 patch (hotFile parent directory fix).
Address laravel-vite-plugin v2.0.0 breaking changes before deploying.
The upgrade from ^1.0 to ^2.0.0 introduces several breaking changes:
- ESM-only: Plugin no longer ships CommonJS builds—your project must use ESM or configure Vite config as
.cjsfiles - Node.js version bump: Drops support for Node 14, 15, 16, 17, 19—verify your Node version matches the minimum required by your Vite version
- server.https config change: Boolean values (e.g.,
server.https: true) no longer supported—use object form instead - Vite version compatibility: Requires upgrading Vite and related plugins (@vitejs, Vue, React) to compatible major versions
- Default paths updated: Refresh and watch paths changed (e.g., new defaults include
app/Livewire/**)
Update vite.config.js (or rename to vite.config.cjs if keeping CommonJS), upgrade Vite and plugins, verify Node version, and test both dev and production builds before merging.
🤖 Prompt for AI Agents
In @package.json at line 14, The package.json now pins "laravel-vite-plugin":
"^2.0.0" which is ESM-only and has breaking changes; update package.json and
project config by either downgrading the plugin or upgrading Vite and related
plugins (vite, @vitejs/*, vue/react plugins) to compatible majors, ensure your
Node version meets the new minimum, and modify vite.config.js (or rename to
vite.config.cjs if you must keep CommonJS) to address ESM requirements and the
new server.https shape (replace boolean server.https: true with an object form),
verify any default path changes (e.g., refresh/watch patterns like
app/Livewire/**) and run full dev and production builds to confirm no
regressions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ddf616b550
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| 'sqlite' => [ | ||
| 'driver' => 'sqlite', | ||
| 'url' => env('DB_URL'), | ||
| 'database' => $datapasePath, | ||
| 'database' => env('DB_DATABASE', database_path('database.sqlite')), | ||
| 'prefix' => '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normalize sqlite DB_DATABASE to database_path
The sqlite connection now uses env('DB_DATABASE') directly, so a relative value like database.sqlite (the installer’s default) will resolve relative to the app root instead of database_path(). In the Docker image the persistent DB is symlinked at ./database/database.sqlite, so this change points sqlite at /var/www/html/database.sqlite, creating a new empty DB outside the volume and losing persistence across restarts. Consider restoring the database_path() wrapping or normalizing relative paths before using them.
Useful? React with 👍 / 👎.
|
|
||
| 'client' => env('REDIS_CLIENT', 'predis'), | ||
| 'client' => env('REDIS_CLIENT', 'phpredis'), | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid defaulting Redis client to phpredis
Defaulting REDIS_CLIENT to phpredis will break environments that don’t have the PHP Redis extension installed. This repo’s base image doesn’t install that extension while it does include predis/predis, so if REDIS_CLIENT isn’t explicitly set, any Redis usage will throw Class Redis not found / connection errors. Consider keeping predis as the default or ensuring the extension is installed and the env is updated.
Useful? React with 👍 / 👎.
| 'smtp' => [ | ||
| 'transport' => 'smtp', | ||
| 'scheme' => env('MAIL_SCHEME', env('MAIL_ENCRYPTION') === 'ssl' || env('MAIL_ENCRYPTION') === 'tls' ? 'smtps' : 'smtp'), | ||
| 'scheme' => env('MAIL_SCHEME'), | ||
| 'url' => env('MAIL_URL'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve MAIL_ENCRYPTION fallback for SMTP
The SMTP mailer no longer derives scheme from MAIL_ENCRYPTION, so existing deployments that still set only MAIL_ENCRYPTION=tls/ssl will now send with a null scheme. On servers that require TLS, SMTP connections will fail (or downgrade to plaintext if accepted). Consider keeping the fallback or updating env/docs to require MAIL_SCHEME explicitly.
Useful? React with 👍 / 👎.
This reverts commit 42e1c48.
| ], | ||
| "dev": [ | ||
| "Composer\\Config::disableProcessTimeout", | ||
| "npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others" | ||
| ], | ||
| "setup": [ | ||
| "composer install", | ||
| "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"", | ||
| "@php artisan key:generate", | ||
| "@php artisan migrate --force", | ||
| "npm install", | ||
| "npm run build" | ||
| ], | ||
| "test": [ | ||
| "@php artisan config:clear --ansi", | ||
| "@php artisan test" | ||
| ], | ||
| "pre-package-uninstall": [ | ||
| "Illuminate\\Foundation\\ComposerScripts::prePackageUninstall" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ], | |
| "dev": [ | |
| "Composer\\Config::disableProcessTimeout", | |
| "npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others" | |
| ], | |
| "setup": [ | |
| "composer install", | |
| "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"", | |
| "@php artisan key:generate", | |
| "@php artisan migrate --force", | |
| "npm install", | |
| "npm run build" | |
| ], | |
| "test": [ | |
| "@php artisan config:clear --ansi", | |
| "@php artisan test" | |
| ], | |
| "pre-package-uninstall": [ | |
| "Illuminate\\Foundation\\ComposerScripts::prePackageUninstall" |
This was purposely removed in 78aa7d2 and #1994 got refused aswell.
| "autoprefixer": "^10.4.21", | ||
| "concurrently": "^9.0.1", | ||
| "laravel-vite-plugin": "^1.0", | ||
| "laravel-vite-plugin": "^2.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not v2.0.1 ?
| "laravel-vite-plugin": "^2.0.0", | |
| "laravel-vite-plugin": "^2.0.1", |
| "calebporzio/sushi": "^2.5", | ||
| "dedoc/scramble": "^0.12.10", | ||
| "filament/filament": "~4.0", | ||
| "gboquizosanchez/filament-log-viewer": "^2.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please bump this to v2.2.1
| "gboquizosanchez/filament-log-viewer": "^2.1", | |
| "gboquizosanchez/filament-log-viewer": "^2.2", |
|
Superseded by #2081 |
This pull request includes the changes for upgrading to Laravel 12.x. Feel free to commit any additional changes to the
shift-164392branch.Before merging, you need to:
shift-164392branchcomposer update(if the scripts fail, try with--no-scripts)If you get stuck, never hesitate to email support. If you need more help with your upgrade, check out the Human Shifts.