tlikai/laravel-repository
A Laravel package that adds a clean repository layer to your app, wrapping database queries behind interfaces for better separation of concerns, easier testing, and swappable data sources. Ships with base repository classes and service provider bindings for quick setup.
Architecture fit. The package implements the repository + criteria pattern on top of Laravel's Eloquent/Query Builder, letting callers compose query fragments (FuzzySearch, AttributeSearch) declaratively via pushCriteria. Release 1.0.5 does not change that architecture or the public API; it changes how criteria fragments are concatenated into SQL. Fit with a standard Laravel service/repository layering is unchanged.
Integration feasibility. Low effort: a Composer version bump, no code changes required at call sites. The documented invocation (pushCriteria(new FuzzySearch(...)) followed by pushCriteria(new AttributeSearch(...))) behaves identically at the API level — only the generated WHERE clause grouping differs.
Technical risk. Moderate, and mainly semantic rather than technical. The release fixes incorrect boolean precedence: previously the OR from FuzzySearch was not grouped, so the subsequent AND city = ... bound only to the last OR branch. The new SQL wraps the OR group in parentheses, which is the correct behavior — but it is a behavioral change shipped under a patch version (1.0.5). Any code, report, export, or test that was implicitly relying on the old, overly-broad result set will now return a narrower set. There is no deprecation path and no stated semver rationale. Secondary risk: the release note's "Old" example contains a malformed fragment (LIKE "%%Jack"), so the documented before/after is not a trustworthy specification of the change.
Key questions.
orWhere cases inside AttributeSearch)?OR, or only to FuzzySearch?LIKE escaping, and collation handling (pinyin column) unaffected?Stack fit. Native to Laravel; no new dependencies, drivers, or services introduced. It slots into the existing repository layer wherever search criteria are composed, and does not affect controllers, models, or migrations.
Migration path. Treat as a behavioral upgrade rather than a drop-in patch:
toSql(), getBindings()) or snapshot query output — these will fail if present, and that failure is expected.pushCriteria call sites that combine FuzzySearch with AttributeSearch (or any OR-emitting criteria), including admin filters, exports, and API search endpoints.Compatibility. API-compatible; result-set-incompatible for combined criteria. Verify the package's Laravel/PHP constraints against our runtime before bumping, and confirm no other pinned dependency conflicts.
Sequencing. Upgrade in isolation (no feature work in the same release), validate in staging against production-like data, then ship. Prefer a dedicated release window so that any "search results changed" reports are unambiguously attributable to this bump.
Maintenance. Net positive: the fix removes a class of silently-wrong query results that would otherwise surface as data-quality bugs. No ongoing maintenance burden added.
Support. Expect a short tail of user-reported "I used to see more results" tickets after deploy, concentrated in search/filter and export features. Pre-brief support and CS with a one-line explanation ("search filters now combine correctly; OR-groups are properly scoped"), and be ready to reconcile any saved reports or dashboards built on the previous behavior.
Scaling. No change in query volume or shape beyond added parentheses. However, the grouping change can alter the optimizer's plan — on large users tables, re-check EXPLAIN for the affected search queries to confirm index usage on name/pinyin/city has not regressed. If searches are behind a cache or a search index, invalidate after deploy.
Failure modes.
orWhere used inside AttributeSearch; verify rather than assume.composer update broadly rather than targeting this version, unrelated transitive changes can land alongside it.Ramp-up. Minimal. Existing developers already know the criteria API; the only new knowledge is "OR-emitting criteria are now grouped," which belongs in a one-paragraph internal note or the team's Laravel conventions doc.
How can I help you explore Laravel packages today?