承接 craftcms/generator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

craftcms/generator

最新稳定版本:2.2.0

Composer 安装命令:

composer require craftcms/generator

包简介

Craft CMS component generator

README 文档

README

Craft Generator icon Craft Generator

Scaffold new Craft CMS plugins, modules, and system components from the CLI.

Installation

To install, run the following command within a Craft project:

composer require craftcms/generator --dev

Note If you get the following prompt, make sure to answer y:

yiisoft/yii2-composer contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "yiisoft/yii2-composer" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json)

Usage

Run the following command to output the usage instructions:

php craft make

Plugin and module generation

You can create new plugins and modules using the following commands:

php craft make plugin
php craft make module

System component generation

You can create new system components using the following commands:

php craft make asset-bundle
php craft make behavior
php craft make command
php craft make controller
php craft make element-action
php craft make element-condition-rule
php craft make element-exporter
php craft make element-type
php craft make field-type
php craft make filesystem-type
php craft make generator
php craft make gql-directive
php craft make model
php craft make module
php craft make plugin
php craft make queue-job
php craft make record
php craft make service
php craft make twig-extension
php craft make utility
php craft make validator
php craft make widget-type

All component generation commands require one of the following options to be passed, which identify where the component is going to live:

  • --app
  • --module=<module-id>
  • --plugin=<plugin-handle>

For example, if you’re creating a new field type for a plugin called foo-bar, you would run:

php craft make field-type --plugin=foo-bar

Creating custom generators

If you have a plugin that has its own component type that could benefit from a custom generator, you can quickly create one with the following command:

php craft make generator --plugin=<plugin-handle>

You’ll be presented with the following prompts:

  • Generator name: Your generator’s class name (sans namespace)
  • Generator namespace: The namespace your generator class should live in
  • Base class for generated [type]: An existing base class which generated classes should extend
  • Default namespace for generated [type]: The default namespace which the generator should suggest, relative to the plugin/module’s root namespace

Your generator will be created based on the provided class name and namespace, which extends craft\generator\BaseGenerator.

Roadmap

The following generator types are being considered for future releases:

  • Events
  • Exceptions
  • GraphQL arguments
  • GraphQL directives
  • GraphQL interfaces
  • GraphQL mutations
  • GraphQL queries
  • GraphQL resolvers
  • GraphQL types
  • Migrations
  • Tests

统计信息

  • 总下载量: 350.72k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 88
  • 点击次数: 1
  • 依赖项目数: 38
  • 推荐数: 0

GitHub 信息

  • Stars: 88
  • Watchers: 7
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: mit
  • 更新时间: 2022-12-13