orchestra/canvas
Composer 安装命令:
composer require orchestra/canvas
包简介
Code Generators for Laravel Applications and Packages
README 文档
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:
| Command. | Description |
|---|---|
make:channel |
Create a new channel class |
make:command |
Create a new Artisan command |
make:controller |
Create a new controller class |
make:event |
Create a new event class |
make:exception |
Create a new custom exception class |
make:factory |
Create a new model factory |
make:job |
Create a new job class |
make:listener |
Create a new event listener class |
make:mail |
Create a new email class |
make:middleware |
Create a new middleware class |
make:migration |
Create a new migration file |
make:model |
Create a new Eloquent model class |
make:notification |
Create a new notification class |
make:observer |
Create a new observer class |
make:policy |
Create a new policy class |
make:provider |
Create a new service provider class |
make:request |
Create a new form request class |
make:resource |
Create a new resource |
make:rule |
Create a new validation rule |
make:seeder |
Create a new seeder class |
make:test |
Create a new test class |
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
PackageNameto 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.
orchestra/canvas 适用场景与选型建议
orchestra/canvas 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20.19M 次下载、GitHub Stars 达 209, 最近一次更新时间为 2020 年 01 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 orchestra/canvas 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 orchestra/canvas 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 20.19M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 211
- 点击次数: 19
- 依赖项目数: 174
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-02