willvincent/laravel-unique
willvincent/laravel-unique provides a simple trait for generating unique values on Eloquent models, making it easy to assign distinct IDs, codes, or tokens to records with minimal configuration in any Laravel application.
Architecture fit. The package sits in the Laravel validation layer, extending or wrapping the framework's exists() rule (the Rule::exists() / string-syntax exists:table,column,... family that resolves to a DatabasePresenceVerifier lookup). That is a low-coupling position in a Laravel application: it is consumed at the HTTP boundary via Form Requests, Validator::make(), or inline $request->validate() calls, and it does not own persistence, routing, or domain logic. For a TPM this is favourable — adoption is reversible and blast radius is confined to request validation paths.
Integration feasibility. Release 1.2 is a single bug fix with no new features, deprecations, or public API changes. Expected effort is a composer update plus a regression pass; no application code changes should be required.
Technical risk. The fix changes runtime validation outcomes for any rule where constraint fields were previously misapplied. Two directions are possible and the release note does not disambiguate them:
Rule::exists('projects','id')->where('tenant_id', $tenantId)). That is a silent data-integrity / cross-tenant reference risk that may already exist in production data written under 1.1 and earlier.The second case is the material one: it implies a possible historical exposure requiring a data audit, not just a library bump.
Key questions.
exists() check was affected, and were constraints previously over-applied (false rejects) or under/mis-applied (false accepts)?exists() explicitly?Stack fit. Standard Composer-installed Laravel dependency. No service, queue, or infrastructure touchpoints. Fits existing CI (PHPUnit/Pest) without new tooling.
Migration path. Pin to ^1.2 in composer.json, run the full validation test suite, then a targeted regression set (below). No config or migration files are expected from a patch-level fix — confirm via the diff before merging.
Compatibility. Verify against our exact Laravel minor and PHP version; a validation-layer patch can behave differently across framework versions if it relies on DatabasePresenceVerifier internals. Also confirm no other package in the graph extends the same exists path (competing validators, tenancy packages that decorate the presence verifier) — those are the likely conflict points.
Sequencing.
exists() first: happy path, constraint violation, soft-deleted row, wrong-tenant row, nullable constraint field. Verify they fail on 1.1 and pass on 1.2.Maintenance. Low. Patch-level dependency with a narrow surface; the ongoing cost is keeping the constraint-scoped validation tests in CI so future upgrades are cheap.
Support. Single-maintainer risk is the usual concern for validation-layer packages — assess bus factor. A one-line bug fix shipping as 1.2 suggests an active but minimal-maintenance project; acceptable for a validation helper, less so if it becomes load-bearing for authorisation-adjacent scoping.
Scaling. No meaningful performance delta expected. Do confirm that corrected constraints still resolve to indexed columns; a constraint applied to an unindexed field turns exists() into a slower query under load, and this fix may add a predicate that previously was not emitted.
Failure modes.
Ramp-up. Low for engineers already fluent in Laravel validation; the learning cost is in understanding the constraint syntax, not the package. Budget modest QA time to author the scoped-exists() regression cases — that test set, not the upgrade itself, is the durable asset here.
How can I help you explore Laravel packages today?