- Is micayael/native-query-from-file-builder-bundle a Laravel package?
- No. It is packaged as a Symfony bundle, not a Laravel package. There is no Illuminate service provider, Laravel facade, or Composer package-discovery entry, so it will not auto-register in a Laravel app. Adopting it in Laravel requires a translation layer or a fork.
- How do I install native-query-from-file-builder-bundle in Laravel?
- You can install it with Composer, but Laravel will not discover or boot it automatically. You must write a custom ServiceProvider that manually instantiates the query registry or builder, wires YAML file paths, and binds it as a singleton. Symfony's bundle extension and compiler-pass configuration are not available, so you also reimplement config validation.
- What is this package used for?
- It is for building native SQL queries from YAML file definitions. The goal is to keep complex SQL outside PHP so it can be versioned, reviewed, and edited by non-PHP developers. It fits reporting, analytics, and legacy-database access where Eloquent or the query builder is a poor fit.
- Does it integrate with Laravel's DB facade or Eloquent, and which Laravel versions work?
- Likely not directly. This family of packages typically builds on doctrine/dbal rather than Illuminate's database layer, so you either add a parallel DBAL connection stack or adapt the executor to Laravel's DB::connection()->select(). There is no official Laravel support matrix because the package targets Symfony, and Symfony component constraints may conflict with your Laravel and PHP versions. Check composer.json constraints before assuming compatibility.
- Is it safe from SQL injection, and does it prevent unsafe user input?
- Safety depends entirely on the parameter-binding contract. YAML-authored SQL is only as safe as how named parameters, typed binding, and array or IN expansion are handled. Audit whether values are bound or interpolated into SQL strings, and test malicious input before any tenant-facing use. Do not treat file-based SQL as inherently safer.
- Does it support multiple connections, read replicas, and existing transactions?
- Verify this before relying on it. The package is Symfony-oriented and typically DBAL-based, so multiple connections, read replicas, and participation in an existing Laravel transaction are not guaranteed. A dual connection and transaction stack is a correctness hazard. You may need to replace the executor with an adapter over Laravel's connection.
- Does it cache parsed YAML or read files on every query?
- The provided context does not confirm caching. You should inspect the implementation to see whether parsed YAML is cached or the filesystem is hit on every query. If there is no cache, add one in your wrapper because repeated file reads can hurt reporting endpoints.
- How do I test YAML-defined native queries in Laravel?
- Spike it in a scratch Laravel app with a provider shim rather than assuming drop-in behavior. Execute representative queries: a simple select, a parameterized IN query, and a multi-join report. Assert the binding and hydration behavior, and run the tests against the same database engine you use in production. Use transactions or a dedicated test database to keep tests isolated.
- What are alternatives for managing native SQL files in Laravel?
- A common alternative is a small internal service, roughly 150 to 250 lines, with a SqlFileRepository, a YAML loader, and a NamedQueryExecutor over DB::connection()->select(). You keep the file-based SQL workflow without the Symfony bundle lifecycle or DBAL dual-stack risk. Laravel's raw DB::select with bindings, views, or stored procedures are other options depending on your team.
- Who maintains it and is it production-ready?
- It has zero stars and zero dependents, with a single-maintainer signal and no evidence of CI, static analysis, or security review in the context. That makes abandonment and unverified security posture high risks. It is not recommended as a direct production dependency without a spike, audit, and likely a fork or internal reimplementation.