tpetry/laravel-query-expressions
Add powerful SQL expression support to Laravel’s query builder. Compose reusable, type-safe expressions for functions, casts, JSON ops, windows, and more, with clean syntax and cross-database compatibility—ideal for advanced filtering, sorting, and computed columns.
Adopt if:
DB::select(), DB::table()->toSql()) and wants to replace it with a structured, debuggable alternative.Look elsewhere if:
For Executives: "This package lets our engineers replace error-prone raw SQL with a structured, reusable query system—like building blocks for database operations. It cuts debugging time, reduces SQL injection risks, and future-proofs our admin tools/APIs. For example, a complex dashboard filter that now takes 2 devs 2 weeks could be built in days with maintainable code. The MIT license and Laravel ecosystem adoption make it a low-risk upgrade."
For Engineers: *"Imagine writing queries like this instead of raw SQL:
$users = Query::select('users.*')
->from('users')
->where(Query::expr('age > ?', [25]))
->join('orders', Query::expr('users.id = orders.user_id AND orders.status = ?', ['active']))
->get();
For Security/Compliance Teams: "This package enforces parameter binding and structured query composition, eliminating most SQL injection vectors. It’s a drop-in replacement for raw SQL calls, so we can audit and standardize queries without rewriting business logic."
How can I help you explore Laravel packages today?