- What does spawnia/sailor generate for a Laravel application?
- The package blurb and technical assessment describe Sailor as a GraphQL code generator that produces typed PHP client classes from your schema and .graphql operation files. That means you can call typed operations instead of maintaining hand-written query strings. Some summaries describe TypeScript generation, so verify the current README and release notes before committing to the package.
- How do I install and configure Sailor in Laravel?
- Install it through Composer, publish any package configuration, and point it at either a GraphQL schema file or an introspection endpoint. Then run the package's Artisan generation command and bind the generated client through a Laravel service provider. Check the README for exact command names and configuration keys, because release metadata should be validated before adoption.
- Which Laravel and PHP versions does Sailor support?
- Support depends on the package's Composer constraints for PHP, PSR interfaces, Guzzle or other HTTP clients, and GraphQL libraries. The technical assessment flags dependency validation as a required step against your target Laravel version. Run a Composer dry-run or a time-boxed spike before upgrading Laravel or PHP.
- Can Sailor use Laravel's HTTP client, Guzzle, or a PSR-18 client?
- Native transport support is the main integration uncertainty; confirm whether Sailor accepts PSR-18, Guzzle, or Laravel's HTTP client directly. If it does not, add a thin adapter and centralize auth headers, retries, timeouts, correlation IDs, and logging. Wrap the generated client behind an application interface so the transport remains replaceable.
- How should code generation run in CI for a Laravel app?
- Treat Sailor generation as a build or CI step, not a manual developer action, and pin the schema used for generation. Prefer deterministic, offline generation from a checked-in schema if the package supports it, and treat generated files as build artifacts or reviewed generated code. Never hand-edit generated client classes, and watch for noisy diffs from generated-code churn.
- Where should generated GraphQL client code live in a Laravel project?
- Place generated code in a clearly named namespace such as App\Integrations\GraphQL\Generated and keep it out of domain models. Wrap Sailor behind application-specific interfaces or a service provider, then inject the client into actions, jobs, integration services, or admin tooling. Avoid calling generated GraphQL types directly from controllers so the GraphQL transport stays replaceable.
- Does Sailor replace a GraphQL server such as Lighthouse?
- No. Sailor is a client-side GraphQL code-generation package, not a GraphQL server or Laravel-native framework component. It fits Laravel apps that consume external or internal GraphQL APIs, including service-to-service clients, admin tooling, and contract tests. If your app already exposes GraphQL through Lighthouse, Sailor does not replace that server.
- How are GraphQL errors, partial responses, and HTTP failures handled?
- Generated types are only as strong as the schema and generation workflow, so partial GraphQL errors, nullable changes, deprecated fields, and HTTP failures can still cause runtime problems. Confirm how Sailor represents GraphQL errors, partial responses, retries, and transport failures in generated types. Add contract tests for representative responses and centralize error handling in your adapter layer.
- Is spawnia/sailor maintained and safe for production use?
- Adoption signals are weak: around 95 GitHub stars and a low overall assessment score indicate a niche package with limited ecosystem validation. Maintainer concentration and long-term support are real risks, and release metadata includes a future-dated release that should be verified against tags and release cadence. Assign an internal owner and keep a fallback plan, such as a hand-written or adapter-based GraphQL client, before production commitment.
- What are alternatives to Sailor for typed GraphQL in Laravel?
- Alternatives include hand-written typed wrappers around a generic PHP GraphQL client, GraphQL Code Generator if a Node toolchain is acceptable, or contract tests against a checked-in schema. For Laravel teams, the safest comparison is a time-boxed spike against one non-critical operation using your existing manual client as the baseline. Introduce an application-level interface first so switching code generators or transports remains reversible.