Repository navigation
Update to "spatie/laravel-permission" to 7 or 8? #2519
Replies: 3 comments 1 reply
|
I'll take a look. |
TL;DRI tested upgrading Lunar's This looks like a very small, low-risk lift for Lunar 2.x. The required change should be limited to updating the dependency constraint in the root Research report
ConclusionI found that Lunar can upgrade directly from The target package requires PHP The breaking changes in v7 and v8 mainly affect applications that:
I searched Lunar for these extension points and did not find affected usage. Lunar uses the standard Current Lunar stateThe dependency is declared in two places:
Both constraints need to change. The root declaration controls monorepo development and CI, while the core declaration controls the dependency required by consumers of the split The repository ignores
Platform compatibility
The original Relevant upstream changesv6 to v7Version 7 was primarily a code-modernization release. Its documented breaking changes include:
v7 to v8The v8 breaking change is narrow:
This only requires code changes when an application implements those contracts in custom models. Lunar does not. v8.1 through v8.3The later v8 releases mainly contain fixes:
I did not find Lunar usage of package events, teams, custom permission pivots, wildcard permissions, or tenant-specific registrar cache switching. Lunar also keeps staff permissions on its configured staff guard, so the unusual multi-guard caveat should not affect its normal authorization flow. Lunar integration audit
I reviewed representative integration points including:
Configuration assessmentLunar does not ship a customized The default config differences between the reviewed v6 and v8 releases are comments and fully qualified class-name formatting. I did not find a new required setting or changed default that Lunar needs to copy. No Lunar configuration change is required. Database assessmentLunar owns its permission-table migration at:
The upstream v8 migration stub includes syntax modernization such as:
These changes create the same relevant schema. I found no new tables, columns, indexes, pivot keys, or foreign-key relationships between the v6.25 and v8.3 stubs. Therefore:
I recommend keeping the first PR dependency-only. Editing a migration that may already have shipped in alpha releases would increase the review surface without changing the resulting schema. Upgrade test performedI created a disposable clone of Lunar's The local test environment resolved:
I then ran Composer validation, PHPStan, and the Lunar suites most relevant to authorization and the packages that register Spatie's service provider.
All tests that ran passed. No production PHP changes were needed to reach that result. An initial diagnostic command ran several suites in one Pest process and hit a missing SQLite table caused by the repository's cross-suite database lifecycle. I repeated the same sequence against My local test covered the current/highest Laravel 13 dependency set. Lunar's existing CI matrix will additionally verify:
Expected PR scopeThe recommended functional diff is: - "spatie/laravel-permission": "^6.12",
+ "spatie/laravel-permission": "^8.3",This should be applied to:
I do not expect the PR to need:
Effort estimate
Expected active engineering effort: 1-2 hours. Expected elapsed time including CI: 2-4 hours. I would classify this as an XS/S, low-risk change. Optionally synchronizing Lunar's migration formatting with Spatie's v8 stub would add roughly 30-60 minutes of review and database testing, but it provides no required schema change and should be left out of the initial PR. Residual risks
These are normal, manageable risks for a major dependency bump, especially while Lunar 2.x remains in alpha. RecommendationI recommend submitting the PR. Lunar and SourcesSources reviewed on 2026-09-12:
|
|
PR #2728 has been submitted to address there. There's no code changes. All tests passed. |
Uh oh!
There was an error while loading. Please reload this page.
Lunar still using v6, while v8 has been released. Any chances to update to a newer version, either v7 or v8 (preferred).
I suggest we update this in version 1.5 then push this into v2 so it's one less thing to handle when going to version 2.x.
It seems like a fairly light touch as far as consumers of Lunar, but I don't know if Lunar has any models, custom methods / traits / contracts, or any overrides.
References:
https://spatie.be/docs/laravel-permission/v8/upgrading
All reactions