Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Sql Function Repository Laravel Package

michael-rubel/laravel-sql-function-repository

A lightweight Laravel package that brings the repository pattern to SQL functions, letting you call database functions and stored procedures through clean, testable classes with bound parameters instead of scattered raw queries.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

What the package is. A thin repository abstraction over PostgreSQL stored functions — you define a repository, and calling a method translates into a SELECT * FROM fn_name(?, ?)-style invocation through Laravel's DB layer. It is a convenience wrapper, not an ORM, not a query builder, and not a persistence layer. Package surface is small (repository base class plus supporting traits/contracts), which still matters a great deal for the risk calculation below.

Architecture fit. Fits only if three conditions hold simultaneously: (1) the primary datastore is PostgreSQL and will remain so; (2) the team already owns or intends to own business logic inside database functions; (3) the codebase already uses a repository pattern, so this slots into an existing seam rather than introducing a new one. If the team's convention is "logic in PHP, database is dumb storage," this package is architecturally backwards and will be rejected in review regardless of quality. The 1.1.2 release does not change this calculus.

Integration feasibility. Mechanically trivial — composer require, extend the base repository, inject via container. No service provider complexity to speak of, no config surface, no migrations of its own. A competent Laravel developer can evaluate it end-to-end in under a day. The prior assessment flagged the package as archived; release 1.1.2 materially changes that premise by shipping Laravel 10 support via PR #2. That means the resolver is more likely to install cleanly on a Laravel 10 codebase, and the "archived dependency" governance blocker may no longer apply — but this needs confirmation against the repository's current maintenance status and our SCA policy, not just the release note.

Technical risk.

  • Abandonment (downgraded from high to medium, still bounded). The 1.1.2 release adds Laravel 10 support and demonstrates at least nominal maintenance activity after the long gap. That is a real improvement over the prior "archived since early 2023" state. However: 7 stars, 0 dependents, single maintainer, one PR in the release. This is not evidence of a support commitment, security response process, or forward compatibility with Laravel 11/12. Treat it as "alive, not de-risked."
  • Low adoption = low validation (medium, unchanged). Zero dependents means essentially no production hardening outside the author's own usage. Edge cases around parameter binding, named arguments, and result type coercion remain unproven at scale. The Laravel 10 support PR likely only touches framework constraints, not runtime behavior.
  • Ecosystem/CI policy (downgraded from high to procedural/medium). If the repository is no longer archived, the blanket archived-dependency block may not fire. Verify package metadata and SCA results rather than assuming either way. The policy risk has narrowed but not disappeared.
  • Vendor lock-in (low, unchanged). This is the mitigating factor: the package is a few hundred lines of commodity code. Escape cost is hours, not weeks. Fork, vendor, or reimplement the pattern internally with no meaningful rewrite.
  • PostgreSQL coupling (medium, unchanged). Hard-codes a single engine. Kills any SQLite-based test suite and any multi-engine or read-replica strategy that assumes portable SQL.

Key questions.

  1. Do we have PostgreSQL functions in production today, or is this speculative? If speculative, the package is solving a problem we don't have.
  2. Which Laravel minor are we actually on? 1.1.2 explicitly adds Laravel 10 support, so the resolver question is now narrower: confirm composer.json constraints for laravel/framework, illuminate/*, and php resolve against our exact stack, and confirm whether Laravel 11/12 is in scope for our roadmap.
  3. Has the package's archived status actually been lifted, and does our dependency policy now permit it? Do not infer governance clearance from a release note alone.
  4. Who owns the DB function lifecycle — application team or DBA — and how are functions versioned and migrated?
  5. Are we prepared to fork and take internal ownership if upstream maintenance stalls again, or does the single-maintainer profile mean "no" for revenue-critical paths?

Integration Approach

Stack fit. Laravel + PostgreSQL only. The 1.1.2 release specifically improves fit for Laravel 10, so if that is our target, the prior "resolver may simply refuse" concern is substantially reduced. Still verify against our exact Laravel minor and PHP version before anything else — added framework support does not guarantee PHP 8.3+ or Laravel 11/12 compatibility. Note the package predates recent Laravel skeleton changes and may rely on container or facade behavior that has since shifted.

Migration path. Three viable routes, with the recommendation shifting slightly:

  • Route A — fork and internalize. Vendor the source into app/Support/Database/ or publish as an internal Composer package under our own namespace. Preserves the API, removes dependency-policy exposure, and gives us a place to add PHP 8.4/Laravel 11+ support ourselves. Cost: roughly one engineer-day plus ongoing (small) ownership. Still the safest route for multi-year, revenue-critical use.
  • Route B — reimplement the pattern. Write a ~100-line abstract repository in-house (DB::selectOne('select * from '.$fn.'(?)', $bindings) plus result hydration). Same behavior, zero external dependency, no fork overhead. Slightly more upfront work, strictly better long-term posture. Remains the cleanest option if we want the pattern without the package.
  • Route C — depend directly. Now more defensible than before if we are on Laravel 10 and the use is internal, non-critical, or prototype-stage. The 1.1.2 release removes the most obvious installation blocker. It is still not the right default for a load-bearing, multi-year path given the single-maintainer and low-adoption profile.

Compatibility. Confirm function overloading, default arguments, and OUT/SETOF return shapes are handled — these are where naive wrappers break. Also check how numeric/decimal returns are cast; PDO will hand back strings and that will leak into API responses if unhandled. The Laravel 10 PR likely does not address these runtime concerns, so validate them explicitly.

Sequencing.

  1. Spike: install 1.1.2 in a branch against a scratch Postgres instance with one trivial function; confirm the resolver, the call path, and result typing. Timebox to one day. This now has a higher chance of succeeding on Laravel 10 than the prior version did.
  2. Confirm repository maintenance status and SCA policy outcome; decide fork vs. reimplement vs. direct dependency based on spike findings and criticality.
  3. Establish the DB-function conventions first (naming, migration strategy, grants, versioning) before wiring any repository — the convention is the hard part, the wrapper is not.
  4. Pilot on one non-critical read path; instrument it; expand only after the operational story is proven.

Operational Impact

Maintenance. The 1.1.2 release reduces the "zero upstream maintenance" concern, but only modestly. We now have evidence of a maintainer responding to a Laravel compatibility gap, which is better than an archived repository. We do not have evidence of a release cadence, security process, or commitment to future Laravel majors. Every future Laravel or PHP upgrade may still require a manual compatibility check we own. The code is small enough that this is a recurring nuisance rather than a crisis, but it remains a permanent small tax. Budget for it; do not assume upstream will handle it.

Support. Upstream support exists again in the loosest sense — a maintainer merged a compatibility PR and cut a release. There is still no SLA, no commercial backing, and no documented security response path. Internal engineers remain the effective support tier. Acceptable for a small internal pattern; questionable if this becomes load-bearing for revenue-critical paths without an internal owner named.

Scaling. The real scaling concern is architectural, not the package: pushing logic into Postgres concentrates compute on the least horizontally-scalable tier. Application servers scale out cheaply; the primary database does not. Functions that begin as "simple" have a well-documented tendency to grow joins, loops, and row-by-row processing. This package makes that path easier to walk, which is a strategic caution, not a technical defect. Also flag connection poolers (PgBouncer in transaction mode) — any function that relies on session state or SET will behave inconsistently across pooled connections.

Failure modes.

  • Function absent or renamed in a target environment → runtime UndefinedFunction exception; there is no schema-level safeguard in the package. Mitigate with a boot-time assertion or a smoke test per environment.
  • Missing EXECUTE grants for the app role → failures that appear only in staging/prod, never locally where the developer is superuser. Very common, very preventable.
  • Exception raised inside a function participates in the surrounding transaction and can poison it; error surfaces as an opaque driver message. Wrapping conventions are needed.
  • Statement timeout / long-running function blocking a pooled connection under load; the package adds no timeout ergonomics.
  • Return-type drift when a function's signature changes without an app-side change — silent string-vs-int leakage into JSON.
  • Re-emergence of upstream dormancy: the package went quiet once and could again. The fork/reimplement escape hatch remains the primary mitigation.

Ramp-up. Near zero. Any Laravel developer reads the source in an afternoon. The ramp-up cost is entirely in the PostgreSQL side: developers who have never authored or debugged PL/pgSQL functions will struggle, and that is a skills gap the package neither creates nor solves.

TPM recommendation. Update from the prior "do not add in archived form": 1.1.2 materially improves the dependency story for Laravel 10 and removes the archived-package blocker as the primary reason to reject. That said, this remains a narrow wrapper around an architectural choice — PostgreSQL functions as a first-class home for business logic — and the release does not validate that choice. If we are on Laravel 10, already use Postgres functions intentionally, and the use is internal or non-critical, direct dependency is now defensible after a one-day spike and SCA confirmation. For revenue-critical or multi-year paths, still prefer forking internally or reimplementing the pattern in-house; the package is small enough that ownership cost is low and the single-maintainer risk is easier to eliminate than to monitor. If we do not already use PostgreSQL functions, the correct action remains to skip this package and revisit the broader question of whether business logic belongs in the database at all. The package is cheap to try, cheap to leave, and solves a narrow problem; it is a pattern reference, not a platform decision.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource