- Can Orchestra Canvas replace Laravel’s built-in `make:` commands in my existing Laravel 12 app?
- Yes, Canvas seamlessly overrides Laravel’s `make:` commands via `LaravelServiceProvider` without modifying your existing codebase. Install it as a dev dependency, and all `php artisan make:` commands will use Canvas’s generators instead. Just ensure your `canvas.yaml` presets align with your project’s namespace and path conventions.
- How do I use Orchestra Canvas for developing Laravel packages *outside* a full Laravel install?
- Canvas supports standalone package development via `vendor/bin/canvas`. Run commands like `canvas make:model User` directly in your package directory. Configure `canvas.yaml` to define package-specific namespaces and stubs, ensuring generated files match your package’s structure. No Laravel install is required.
- What Laravel versions does Orchestra Canvas support, and will it work with Laravel 13?
- Canvas officially supports Laravel 11–13 (and back to 10.x) with backward-compatible stubs. For Laravel 13, verify the latest Canvas release includes updated stubs for new features like PHP 8.3+ syntax. Check the [GitHub releases](https://github.com/orchestral/canvas/releases) for version-specific notes.
- How do I customize the generated stubs (e.g., add Sanctum auth to model stubs)?
- Override default stubs by placing custom files (e.g., `user-model.stub`) in your project’s `resources/stubs/` or `stubs/` directory. Canvas will use these instead of the defaults. For validation, pair with `orchestra/sidekick` to test stubs locally before team adoption. Example: Add `$this->givePermission('access');` to your `user-model.stub`.
- Will Orchestra Canvas work with my monorepo setup where packages and apps share code?
- Yes, Canvas’s `canvas.yaml` preset system lets you define project-specific configurations for both apps and packages. Use the `presets` key to switch between Laravel app mode (overriding `make:`) and package mode (standalone `canvas` CLI). This ensures consistent stubs and namespaces across your monorepo.
- Does Orchestra Canvas generate tests, and how does it compare to PestPHP’s `--unit` flag?
- Canvas generates basic test stubs (e.g., `make:test`) for controllers, models, and jobs, but it’s not a full testing framework. For advanced testing, combine Canvas with PestPHP or PHPUnit. Avoid mixing tools—stick to one for scaffolding to prevent confusion. Example: Use `make:test UserController` for a starting point, then expand with Pest.
- How do I handle existing, non-standard files (e.g., manually created controllers) when adopting Canvas?
- Canvas won’t overwrite existing files. Use `canvas.yaml` to enforce new conventions (e.g., `paths: { controllers: app/Http/Controllers }`) while grandfathering old files. Run `canvas validate` to check for inconsistencies. For migrations, Canvas generates new files but won’t alter existing database tables.
- Are there performance concerns with using Orchestra Canvas in production?
- Canvas adds negligible runtime overhead since it only affects code generation (dev-time). The `canvas.yaml` file is parsed once per command, which is fast for typical workflows. For heavy usage, cache the parsed config in memory or pre-generate stubs. No production performance impact is expected.
- What alternatives exist to Orchestra Canvas for Laravel code generation?
- Alternatives include Laravel’s built-in `make:` commands (limited customization), `laravel-shift/blueprint` (for large-scale scaffolding), or `spatie/laravel-model-generator` (model-focused). Canvas stands out for its Laravel-native integration, stub customization, and package-first support. Evaluate based on your need for flexibility vs. simplicity.
- How do I add IDE support (e.g., VSCode snippets) for Canvas-generated files?
- Canvas generates standard PHP files with correct namespaces, so they work out-of-the-box in IDEs like VSCode or PHPStorm. For snippets, create custom extensions targeting the generated file structure (e.g., `app/Http/Controllers/{name}.php`). Example: Add a snippet for `@method GET index()` in controller stubs. Check the [Canvas docs](https://github.com/orchestral/canvas#ide-integration) for path templates.