PHPackages                             davidgamboa/magento2-module-scaffold - 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. [CLI &amp; Console](/categories/cli)
4. /
5. davidgamboa/magento2-module-scaffold

ActiveProject[CLI &amp; Console](/categories/cli)

davidgamboa/magento2-module-scaffold
====================================

CLI to scaffold Magento 2 modules in one command

1.0.0(yesterday)04↑2900%MITPHPPHP &gt;=8.1

Since Jun 13Pushed yesterdayCompare

[ Source](https://github.com/gamta/magento2-module-scaffold)[ Packagist](https://packagist.org/packages/davidgamboa/magento2-module-scaffold)[ RSS](/packages/davidgamboa-magento2-module-scaffold/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (3)Versions (2)Used By (0)

magento2-module-scaffold
========================

[](#magento2-module-scaffold)

CLI to scaffold Magento 2 modules in one command. Installs globally via Composer — no Magento installation required.

```
composer global require davidgamboa/magento2-module-scaffold
scaffold make Acme/ProductEvents --type=observer --class=ProductSave --event=catalog_product_save_after
```

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

[](#installation)

```
composer global require davidgamboa/magento2-module-scaffold
```

Make sure `~/.config/composer/vendor/bin` (or `~/.composer/vendor/bin`) is in your `PATH`:

```
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
```

Usage
-----

[](#usage)

```
scaffold make Vendor/Module --type= [options]
```

`Vendor/Module` must follow PascalCase: `Acme/ProductEvents`, not `acme/productevents`.

### Output directory

[](#output-directory)

The output directory is resolved in this order:

1. `--output=` — explicit override
2. Magento root auto-detection — walks up from your current directory looking for `bin/magento`, then writes to `{magento_root}/app/code/Vendor/Module/`
3. Fallback — `{CWD}/Vendor/Module/`

### Global options

[](#global-options)

OptionDescription`--output=`Override output directory`--dry-run`Print files that would be generated without writing`--force`Overwrite if the output directory already exists### Interactive mode

[](#interactive-mode)

Any missing required argument triggers a prompt:

```
$ scaffold make MyVendor/MyModule

Module type:
  [0] observer
  [1] plugin
  ...
> 0

Observer class name [MyModuleObserver]: ProductSave
Event name [catalog_product_save_after]:

✓ Generated MyVendor/MyModule (observer) → app/code/MyVendor/MyModule/

```

---

Module types
------------

[](#module-types)

### observer

[](#observer)

Generates an event observer.

```
scaffold make Acme/ProductEvents \
  --type=observer \
  --class=ProductSaveObserver \
  --event=catalog_product_save_after \
  --output=app/code/Acme/ProductEvents
```

**Generated files:**

```
registration.php
etc/module.xml
etc/di.xml
etc/events.xml
Observer/ProductSaveObserver.php
composer.json

```

`etc/events.xml` registers the observer on the given event. `Observer/ProductSaveObserver.php` implements `ObserverInterface` with an `execute()` stub.

---

### plugin

[](#plugin)

Generates a Magento plugin (interceptor) for a target class method.

```
scaffold make Acme/Catalog \
  --type=plugin \
  --class=ProductPlugin \
  --target="Magento\Catalog\Model\Product" \
  --method=getName
```

**Generated files:**

```
registration.php
etc/module.xml
etc/di.xml          ←  block with plugin registration
Plugin/ProductPlugin.php
composer.json

```

The plugin class includes `before`, `after`, and `around` stubs for the target method.

---

### cron

[](#cron)

Generates a Magento cron job.

```
scaffold make Acme/Imports \
  --type=cron \
  --class=ImportProducts \
  --schedule="0 2 * * *"
```

**Generated files:**

```
registration.php
etc/module.xml
etc/di.xml
etc/crontab.xml
Cron/ImportProducts.php
composer.json

```

---

### graphql

[](#graphql)

Generates a GraphQL resolver.

```
scaffold make Acme/ProductGraph \
  --type=graphql \
  --class=ProductResolver \
  --field=products
```

**Generated files:**

```
registration.php
etc/module.xml
etc/di.xml
etc/schema.graphqls
Model/Resolver/ProductResolver.php
composer.json

```

`etc/schema.graphqls` adds a field to the `Query` type. The resolver implements Magento's `ResolverInterface`.

---

### api

[](#api)

Generates a REST API endpoint with interface, repository implementation, and DI preference binding.

```
scaffold make Acme/ProductApi \
  --type=api \
  --class=ProductRepository \
  --interface=ProductRepositoryInterface
```

**Generated files:**

```
registration.php
etc/module.xml
etc/di.xml          ← preference binding
etc/webapi.xml      ← GET/POST/DELETE routes
Api/ProductRepositoryInterface.php
Model/ProductRepository.php
composer.json

```

---

### command

[](#command)

Generates a Magento CLI command (`bin/magento my:command`).

```
scaffold make Acme/Tools \
  --type=command \
  --class=ImportCommand \
  --command-name=import:products
```

**Generated files:**

```
registration.php
etc/module.xml
etc/di.xml          ← injects command into CommandListInterface
Console/Command/ImportCommand.php
composer.json

```

---

Files generated for every type
------------------------------

[](#files-generated-for-every-type)

Every module type includes these four files:

FilePurpose`registration.php`Registers the module with Magento's ComponentRegistrar`etc/module.xml`Declares the module name and version`composer.json`PSR-4 autoload + magento/framework require`etc/di.xml`Base DI config (extended by plugin/api/command types)---

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- Composer

No Magento installation needed. The tool generates files you then drop into any Magento project.

License
-------

[](#license)

MIT

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance100

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8351851?v=4)[Gamta](/maintainers/Gamta)[@gamta](https://github.com/gamta)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/davidgamboa-magento2-module-scaffold/health.svg)

```
[![Health](https://phpackages.com/badges/davidgamboa-magento2-module-scaffold/health.svg)](https://phpackages.com/packages/davidgamboa-magento2-module-scaffold)
```

###  Alternatives

[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

101466.4k45](/packages/friendsoftypo3-content-blocks)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

54642.4k4](/packages/jolicode-castor)[crunzphp/crunz

Schedule your tasks right from the code.

2312.3M7](/packages/crunzphp-crunz)[api-platform/openapi

Models to build and serialize an OpenAPI specification.

374.2M76](/packages/api-platform-openapi)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M509](/packages/shopware-core)[whatsdiff/whatsdiff

See what's changed in your project's dependencies

761.1k](/packages/whatsdiff-whatsdiff)

PHPackages © 2026

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