Download the PHP package craftcms/generator without Composer
On this page you can find all versions of the php package craftcms/generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download craftcms/generator
More information about craftcms/generator
Files in craftcms/generator
Package generator
Short Description Craft CMS component generator
License mit
Homepage https://craftcms.com
Informations about the package generator
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:
Note If you get the following prompt, make sure to answer
y
:
Usage
Run the following command to output the usage instructions:
Plugin and module generation
You can create new plugins and modules using the following commands:
System component generation
You can create new system components using the following commands:
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:
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:
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
- [x] GraphQL directives
- [ ] GraphQL interfaces
- [ ] GraphQL mutations
- [ ] GraphQL queries
- [ ] GraphQL resolvers
- [ ] GraphQL types
- [ ] Migrations
- [ ] Tests
All versions of generator with dependencies
craftcms/cms Version ^5.0.0-beta.1
nette/php-generator Version ^4.0
nikic/php-parser Version ^4.15