- What is scrnhq/laravel-bakery used for?
- Laravel Bakery is a Composer package that generates GraphQL schemas from Eloquent models on the fly for Laravel applications. Its documented purpose is GraphQL schema generation from your model layer, not primarily model factory generation despite any factory-related wording you may see. It is positioned as an accelerator for read-heavy internal APIs, admin panels, prototypes, and teams that want a GraphQL layer without hand-writing SDL first. The TPM assessment recommends treating it as a short proof of concept rather than a strategic, long-term GraphQL contract.
- How do I install laravel-bakery in a Laravel project?
- Install it with Composer from the scrnhq/laravel-bakery package and wire its Laravel service provider through the package's documented integration path. The TPM guidance recommends installing it in a branch, generating schemas for two or three representative models, and validating the resulting GraphQL contract before broader adoption. Run Composer dependency resolution against your actual application, not a clean Laravel skeleton, because transitive GraphQL dependencies can conflict.
- Which Laravel and PHP versions are supported by laravel-bakery?
- The context does not list explicit Laravel or PHP version constraints, and the last release was December 2021, so current compatibility is uncertain. Pin Laravel, PHP, and GraphQL dependency versions in a proof of concept and test against your target application's lockfile. Add a compatibility test matrix and be prepared to patch or fork if the package blocks Laravel upgrades.
- Does laravel-bakery work with Lighthouse or webonyx/graphql-php?
- The TPM assessment flags this as an open question: confirm whether Bakery depends on, complements, or conflicts with Lighthouse, webonyx/graphql-php, or your existing GraphQL layer. Do not add multiple schema generators to the same application without a clear integration test. If you already run Lighthouse, evaluate whether Bakery's generated schema can sit behind reviewed configuration or whether it duplicates existing behavior.
- How does laravel-bakery handle authorization and field exposure?
- Authorization is a primary adoption risk because automatic schema generation can expose model fields and relationships unintentionally. The TPM guidance requires a security review for field- and relationship-level authorization, plus reviewed configuration around the generated schema. Do not expose the endpoint to untrusted consumers until you have verified that missing field-level authorization and accidental relationship exposure are addressed.
- Is the laravel-bakery generated schema deterministic and diffable?
- The TPM assessment explicitly asks whether schema generation is deterministic, cacheable, and diffable, which matters for review and CI. Treat non-deterministic or hard-to-review generated schemas as a risk and test repeated generation against the same models. If output is stable, you can commit or cache the generated SDL and review changes like any other API contract.
- How do I prevent N+1 queries with laravel-bakery GraphQL schemas?
- GraphQL flexibility can create N+1 and query-complexity problems, so enforce depth and cost limits, pagination caps, batching or data-loader patterns, caching, and database indexes. Baseline query performance during the proof of concept and validate generated queries against production-like data volumes before expanding usage. The TPM assessment calls out N+1 behavior as a specific technical risk for this package.
- Is laravel-bakery maintained and safe for production?
- The package is MIT-licensed but has a stale release history, with the last release in December 2021 and a small community, so expect to own maintenance. Upstream support is likely community-only; require internal documentation, runbooks, schema ownership, and a named maintainer. Use it as an accelerator with an explicit exit plan rather than a long-term strategic dependency.
- Can I use laravel-bakery for a public or versioned GraphQL API?
- The TPM assessment says Bakery is a weak fit for public or versioned APIs, domain-driven designs with explicit contracts, polyglot service estates, and organizations requiring schema-first governance. It is better suited to internal tools, admin panels, prototypes, and read-heavy APIs where Eloquent is the authoritative data layer. For public contracts, consider hand-written SDL or a maintained schema-first GraphQL stack.
- What is the exit path if laravel-bakery is abandoned or breaks?
- Preserve the generated SDL as a starting point and be ready to migrate execution to a maintained GraphQL runtime such as Lighthouse or webonyx/graphql-php. The TPM guidance recommends a fork/upstream policy, dependency patch budget, and Laravel upgrade testing if you adopt the package. Decide early whether to adopt, fork, wrap generated SDL, or replace it with a maintained stack.