PHPackages                             craftcms/generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. craftcms/generator

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

craftcms/generator
==================

Craft CMS component generator

2.2.0(11mo ago)88377.0k—5.8%920mitPHPPHP ^8.2CI passing

Since Dec 13Pushed 7mo ago7 watchersCompare

[ Source](https://github.com/craftcms/generator)[ Packagist](https://packagist.org/packages/craftcms/generator)[ Docs](https://craftcms.com)[ RSS](/packages/craftcms-generator/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (24)Used By (20)

[![Craft Generator icon](./icon.svg)](./icon.svg)

 Craft Generator
====================================================================

[](#----craft-generator)

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

Installation
------------

[](#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
-----

[](#usage)

Run the following command to output the usage instructions:

```
php craft make
```

### Plugin and module generation

[](#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

[](#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=`
- `--plugin=`

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
--------------------------

[](#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=
```

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`](src/BaseGenerator.php).

Roadmap
-------

[](#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

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance57

Moderate activity, may be stable

Popularity50

Moderate usage in the ecosystem

Community32

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 89.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~44 days

Recently: every ~115 days

Total

24

Last Release

238d ago

Major Versions

1.7.0 → 2.0.02024-03-06

1.8.0 → 2.1.02024-06-19

2.x-dev → 3.x-dev2025-09-23

PHP version history (3 changes)1.0.0PHP ^8.0.2

2.0.0PHP ^8.2

3.x-devPHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ccdf8b493035de2343c55bd889513e3af5c04d5823482a2b186ad16adb1c3e3?d=identicon)[brandonkelly](/maintainers/brandonkelly)

---

Top Contributors

[![brandonkelly](https://avatars.githubusercontent.com/u/47792?v=4)](https://github.com/brandonkelly "brandonkelly (125 commits)")[![AugustMiller](https://avatars.githubusercontent.com/u/1895522?v=4)](https://github.com/AugustMiller "AugustMiller (9 commits)")[![bencarr](https://avatars.githubusercontent.com/u/867691?v=4)](https://github.com/bencarr "bencarr (2 commits)")[![acalvino4](https://avatars.githubusercontent.com/u/43254861?v=4)](https://github.com/acalvino4 "acalvino4 (1 commits)")[![Jensderond](https://avatars.githubusercontent.com/u/6972822?v=4)](https://github.com/Jensderond "Jensderond (1 commits)")[![mckenzieclark](https://avatars.githubusercontent.com/u/25327?v=4)](https://github.com/mckenzieclark "mckenzieclark (1 commits)")[![olivierbon](https://avatars.githubusercontent.com/u/146041?v=4)](https://github.com/olivierbon "olivierbon (1 commits)")

---

Tags

cmsyii2craftcms

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/craftcms-generator/health.svg)

```
[![Health](https://phpackages.com/badges/craftcms-generator/health.svg)](https://phpackages.com/packages/craftcms-generator)
```

###  Alternatives

[craftcms/ckeditor

Edit rich text content in Craft CMS using CKEditor.

48359.1k52](/packages/craftcms-ckeditor)[craftcms/server-check

Craft CMS Server Check

694.1M2](/packages/craftcms-server-check)[craftcms/guest-entries

This plugin allows you to save guest entries from the front-end of your website.

10693.0k3](/packages/craftcms-guest-entries)[verbb/formie

The most user-friendly forms plugin for Craft.

101372.9k40](/packages/verbb-formie)[verbb/tablemaker

Create customizable and user-defined table fields.

40168.8k1](/packages/verbb-tablemaker)[rynpsc/craft-phone-number

International phone number field.

2265.9k](/packages/rynpsc-craft-phone-number)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
