orchestra/canvas
Orchestra Canvas brings Laravel’s artisan make:* generators to apps and packages. Generate controllers, models, migrations, jobs, mail, middleware, tests and more, with customizable namespaces and stubs—usable inside or outside a full Laravel install.
Laravel-Centric Design: Canvas is architecturally aligned with Laravel’s core make: commands, making it a drop-in replacement for scaffolding needs. The package leverages Laravel’s stub-based generation system, ensuring consistency with existing Laravel applications and packages.
canvas.yaml presets.Modularity: The package is modular by design, with clear separation between:
orchestra/canvas-core).LaravelServiceProvider for Artisan command replacement).make:job-middleware).Dependency Management:
orchestra/canvas-core, orchestra/sidekick, PHP 8.4+, Laravel 11/12/13.laravel/sanctum (for user-model stubs), phpstan/phpstan.sidekick for CLI tools). Potential for dependency bloat if not managed.Laravel Applications:
make: commands via LaravelServiceProvider (Package Discovery).composer exec canvas for non-Laravel environments (e.g., packages).canvas.yaml for customization).Laravel Packages:
src/, resources/).preset: package
namespace: Acme\Auth
paths:
src: src
Monorepos/Multi-Package Projects:
canvas.yaml or per-package configs may conflict.canvas.yaml with dynamic namespace resolution or package-specific configs.| Risk Area | Severity | Mitigation |
|---|---|---|
| Laravel Version Lock | High | Test compatibility with your Laravel version (e.g., v11.0.0+ for Laravel 11). |
| Stub Customization Complexity | Medium | Document stub overrides in README.md; use canvas.yaml for team alignment. |
| Dependency Bloat | Medium | Audit orchestra/sidekick and canvas-core for unnecessary features. |
| CLI Command Conflicts | Low | Prefix Canvas commands with canvas (e.g., canvas make:migration) to avoid Artisan conflicts. |
| Package Development Gaps | Low | Supplement with custom scripts for non-Laravel package assets (e.g., JS/CSS). |
| PHP 8.4+ Requirement | High | Ensure CI/CD and local dev environments support PHP 8.4+. |
Laravel Version Alignment:
Customization Needs:
resources/stubs/ or override via canvas.yaml.plates for PHP templates, make:file for generic files).CI/CD Integration:
# .github/workflows/scaffold.yml
- run: composer exec canvas make:model Post --migration --factory
Team Adoption:
canvas.yaml across projects/packages?
templates/canvas.yaml) or enforce via pre-commit hooks.make: commands in favor of Canvas for consistency.Long-Term Maintenance:
orchestra/sidekick) be managed?
Performance Impact:
Security:
file_put_contents usage).Primary Use Cases:
make: commands with Canvas for consistent scaffolding.make:provider, make:command) outside a Laravel install.canvas.yaml.Stack Compatibility:
| Component | Compatibility | Notes |
|---|---|---|
| Laravel 11/12/13 | ✅ Full support | Uses Laravel’s MigrationGeneratorCommand. |
| PHP 8.4+ | ✅ Required | PHP 8.3 may work but unsupported. |
| Composer | ✅ Required | Installed as a dev dependency. |
| Orchestra/Testbench | ⚠️ Optional (for testing) | Only needed if testing packages. |
| Custom Stubs | ✅ Supported | Override via resources/stubs/. |
| Non-Laravel PHP | ❌ Not supported | Avoid for Symfony/Lumen projects. |
Integration Points:
LaravelServiceProvider that replaces Artisan’s make: commands.php artisan make:model User → php artisan canvas:make:model User.vendor/bin/canvas or composer exec canvas.composer exec canvas make:controller API/UserController --api
canvas.yaml in the project root to customize:
App\Modules\Auth).src/ for package sources).| Phase | Action | Tools/Commands | Risks |
|---|---|---|---|
| Assessment | Audit existing make: command usage in the codebase. |
grep -r "make:" . |
Identify legacy scaffolding. |
| Pilot Project | Test Canvas in a non-critical branch (e.g., feature spike). | composer require orchestra/canvas |
Stub mismatches |
How can I help you explore Laravel packages today?