orchestra / canvas
Code Generators for Laravel Applications and Packages
Installs: 4 754 813
Dependents: 158
Suggesters: 0
Security: 0
Stars: 193
Watchers: 4
Forks: 12
Open Issues: 0
Requires
- php: ^8.2
- composer-runtime-api: ^2.2
- composer/semver: ^3.0
- illuminate/console: ^11.26
- illuminate/database: ^11.26
- illuminate/filesystem: ^11.26
- illuminate/support: ^11.26
- orchestra/canvas-core: ^9.0
- orchestra/testbench-core: ^9.2
- symfony/polyfill-php83: ^1.28
- symfony/yaml: ^7.0
Requires (Dev)
- laravel/framework: ^11.26
- laravel/pint: ^1.17
- mockery/mockery: ^1.6
- phpstan/phpstan: ^1.11
- phpunit/phpunit: ^11.0
- spatie/laravel-ray: ^1.35
- 10.x-dev
- 9.x-dev
- v9.1.3
- v9.1.2
- v9.1.1
- v9.1.0
- v9.0.3
- v9.0.2
- v9.0.1
- v9.0.0
- 8.x-dev
- v8.11.9
- v8.11.8
- v8.11.7
- v8.11.6
- v8.11.5
- v8.11.4
- v8.11.3
- v8.11.2
- v8.11.1
- v8.11.0
- v8.10.1
- v8.10.0
- v8.9.0
- v8.8.0
- v8.7.0
- v8.6.0
- v8.5.2
- v8.5.1
- v8.5.0
- v8.4.1
- v8.4.0
- v8.3.0
- v8.2.0
- v8.1.3
- v8.1.2
- v8.1.1
- v8.1.0
- v8.0.1
- v8.0.0
- 7.x-dev
- v7.11.1
- v7.11.0
- v7.10.0
- v7.9.0
- v7.8.0
- v7.7.0
- v7.6.2
- v7.6.1
- v7.6.0
- v7.5.0
- v7.4.0
- v7.3.0
- v7.2.1
- v7.2.0
- v7.1.0
- v7.0.0
- 6.x-dev
- v6.13.0
- v6.12.0
- v6.11.1
- v6.11.0
- v6.10.2
- v6.10.1
- v6.10.0
- v6.9.0
- v6.8.0
- v6.7.0
- v6.6.0
- v6.5.1
- v6.5.0
- v6.4.0
- v6.3.2
- v6.3.1
- v6.3.0
- v6.2.0
- v6.1.6
- v6.1.5
- v6.1.4
- v6.1.3
- v6.1.2
- 6.1.0
- v6.0.0
- 5.x-dev
- 5.5.0
- v5.4.6
- v5.4.5
- v5.4.4
- v5.4.3
- v5.4.2
- v5.4.1
- v5.4.0
- v5.3.0
- v5.2.0
- v5.1.2
- v5.1.1
- v5.1.0
- v5.0.0
- 4.x-dev
- 4.6.0
- v4.5.2
- v4.5.1
- v4.5.0
- v4.4.2
- v4.4.1
- v4.4.0
- v4.3.1
- v4.3.0
- v4.2.1
- v4.2.0
- v4.1.0
- v4.0.0
- dev-9/dusk-test
- dev-generator-presets
This package is auto-updated.
Last update: 2024-11-05 02:35:58 UTC
README
Canvas replicates all of the make
artisan commands available in your basic Laravel application. It allows everyone to use it:
- outside of Laravel installation such as when building Laravel packages.
- with Laravel by allowing a few customizations to the stub resolved class and namespace.
Installation
To install through composer, run the following command from the terminal:
composer require --dev "orchestra/canvas"
Usages
As a Laravel developer, you should be familiar with the following commands:
Which can be executed via:
php artisan make:migration CreatePostsTable --create
With Canvas, you can run the equivalent command via:
vendor/bin/canvas make:migration CreatePostsTable --create
canvas.yaml
Preset file
To get started you can first create canvas.yaml
in the root directory of your Laravel project or package.
Laravel preset
You can run the following command to create the file:
vendor/bin/canvas preset laravel
Which will output the following as canvas.yaml
:
preset: laravel namespace: App model: namespace: App
Package preset
You can run the following command to create the file:
vendor/bin/canvas preset package
Which will output the following as canvas.yaml
:
preset: package namespace: PackageName user-auth-provider: App\User paths: src: src resource: resources factory: path: database/factories migration: path: database/migrations prefix: '' console: namespace: PackageName\Console model: namespace: PackageName provider: namespace: PackageName testing: namespace: PackageName\Tests
You need to change
PackageName
to the root namespace for your package.
Alternatively, you can set --namespace
option to ensure the namespace is used in the file:
vendor/bin/canvas preset package --namespace="Foo\Bar"
preset: package namespace: Foo\Bar user-auth-provider: App\User paths: src: src resource: resources factory: path: database/factories migration: path: database/migrations prefix: '' console: namespace: Foo\Bar\Console model: namespace: Foo\Bar provider: namespace: Foo\Bar testing: namespace: Foo\Bar\Tests
Integration with Laravel
By default, you can always use composer exec canvas
for Laravel and Packages environment. However, with the Package Discovery Orchestra\Canvas\LaravelServiceProvider
will be installed automatically and override all default make
commands available via artisan so you can use it without changing anything.