.blade.sql files, aligning with infrastructure-as-code principles and easing collaboration between developers and data teams.@if(auth()->check())).Adopt When:
Look Elsewhere If:
"This package lets us write SQL queries like templates—combining the power of raw SQL with the flexibility of Blade. For example, a single .blade.sql file can handle all user-filtering logic for our reporting dashboard, cutting query development time by 40% and making it easier for our data team to iterate. It’s a lightweight, Laravel-native solution that reduces technical debt in our analytics tools while keeping costs low (MIT license, no vendor lock-in)."
Key Outcomes:
*"SqlBlade solves a pain point for teams that need dynamic SQL without the overhead of a full query builder. By storing queries in Blade files (e.g., reports/customer_metrics.blade.sql), we:
@if/@isset logic for conditional clauses.Sql/Reports/).Trade-offs:
*"This is like writing SQL with if statements. Need a query that filters by email or id based on input? Just drop this in select_user.blade.sql:
SELECT * FROM users
WHERE 1
@isset($emails) AND email IN (:emails) @endif
@isset($ids) AND id IN (:ids) @endif;
Then call it via:
$results = app(SqlBladeInterface::class)->executeQuery('user.select', ['emails' => [...]]);
Why it’s useful:
:param syntax for variables (avoids SQL injection).; (required).dd(app('blade')->compileString(file_get_contents(...))))."*How can I help you explore Laravel packages today?