spine/spine-trigonometric-dql-bundle
Spine Trigonometric DQL Bundle adds trigonometric functions to Doctrine Query Language, letting you use sine, cosine, tangent, and related math operations directly in DQL. Keep calculations database-side and queries cleaner with simple integration into Spine/Doctrine projects.
Verdict up front: Low strategic value as a dependency. The bundle is a thin Symfony wrapper around a handful of Doctrine custom DQL function classes. The reusable surface area is small enough that vendoring or reimplementing the function classes is likely cheaper and safer than adopting the package — especially given the zero-star, zero-dependent footprint and Bitbucket-only hosting.
Architecture fit
CompilerPass/Bundle registration of doctrine.orm.custom_*_functions). That wiring is inert in Laravel, where Doctrine integration (via laravel-doctrine/orm or manual EntityManager bootstrap) has its own configuration path.FunctionNode subclasses implementing SIN, COS, TAN, COT, ACOS, ASIN, ATAN, and friends. Each is typically 30–60 lines: parse(), getSql(), and platform-specific SQL emission.DB::raw() or computing in PHP.Integration feasibility
vcs Composer repository, (b) suppress Symfony auto-discovery, and (c) manually register each function in the Doctrine config array.app/Doctrine/Functions/ or a small internal package and register them explicitly. This is a few hours of work and removes the dependency entirely.FunctionNode contracts.getSql() per platform or assume one?Technical risk
FunctionNode subclasses; with no upstream activity, you own the fix.Stack fit
laravel-doctrine/orm (or a custom EntityManager binding), the function classes drop in cleanly. If the app is Eloquent-based, stop here — the package is irrelevant and the trig logic belongs in SQL expressions or PHP.Migration / adoption path
FunctionNode classes, register one (SIN) against the target database in a Laravel test app, and assert output against a native SQL query.App\Doctrine\DQL\*), preserving license headers, and register them explicitly:
doctrine.custom_numeric_functions for scalar-returning functions (SIN, COS, TAN, ACOS, …).custom_string_functions only where the DQL return type is genuinely string-typed (unlikely here).Compatibility
FunctionNode signatures against your Doctrine major before porting.composer install under PHP 8.2+).Sequencing
DB::raw(), the package is unnecessary and the effort ends there. Only proceed to vendoring if DQL-level composition (e.g., embedding trig inside larger DQL expressions or QueryBuilder reuse) is genuinely required.Maintenance
FunctionNode contracts at each major bump) and platform additions.Support
Scaling
SIN()/COS() to a column in a WHERE clause defeats standard B-tree indexes and forces full scans or expression indexes. On large tables this is the dominant cost.Failure modes
DECIMAL rounding passing tests but skewing results at scale. Highest-severity failure because it is invisible.FunctionNode subclasses at query-parse time.ACOS outside [-1, 1]) surfacing as DB exceptions rather than application-level validation.Ramp-up
FunctionNode, custom function registration) are standard.EntityManager bootstrapping, DQL syntax), not the trigonometric functions. Weigh that ramp-up against the trivial effort of a DB::raw() call or a PHP-side calculation.Recommendation: Do not adopt the bundle as a dependency. Evaluate the function classes as reference source, vendor or reimplement the two or three functions actually needed, and gate the decision on a one-day spike proving that DQL-level trig composition is required at all.
How can I help you explore Laravel packages today?