Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Module Builder

330 sites Security covered Drupal 10–11
View on drupal.org

This module helps developers build new Drupal modules by automatically generating code skeletons for various components like entities, plugins, forms, and controllers. It analyzes your existing site code to provide context and can generate code based on detected patterns. It also allows you to manage and regenerate module components within the Drupal UI.

A module which auto-generates a skeleton or "scaffolding" for a module, along with hints on how to fill them in. Useful for newbie developers to learn how Drupal code works, and seasoned developers who are too lazy to look up what arguments a function has to take.

Module Builder is unlike any other code generator in that it analyses your site's code to detect plugin types, hooks, services, and so on. It can then generate code for any of these, whether from core, contrib, or your custom code.

But more than this, module builder can generate:

  • Content and config entity types
  • Plugins of just about any type, with injected services
  • Forms, with injected services
  • Routes and controllers, with injected services
  • Permissions
  • Services
  • Plugin types
  • PHPUnit test case classes, and test modules
  • An api.php file to document the module's hooks
  • An admin settings form
  • A README file
  • ... and more.

You can watch a demonstration of some of the components that can be generated.

You can read more about how to use Module Builder on the documentation site.

Module Builder saves the data for a generated module as a config entity, meaning that you can return to a generated module and add or change its components and generate code again.

Module Builder also has partial functionality for adopting and existing module as a module config entity, to then add further code to it. For example, this allows adopting an existing service class and adding an extra injected service to it.

There is also experimental code for generating a theme.

Installation

  1. Install Module Builder with Composer, as with a normal module, but with the '--dev' Composer option, so that Module Builder is not deployed to production servers. WARNING: Module Builder is a developer tool. It should NEVER be installed on a production site, as it has the capability to write to the site's codebase.
  2. Go to Administration › Configuration › Development › Module Builder › Analyse and run the code analysis.
  3. Go to Administration › Configuration › Development › Module Builder › Modules and add a new module entity.

Versions

  • Drupal 8/9/10/11: 4.x is stable and being actively developed. This provides a Drupal UI. For use with Drush commands, use the Drush command.
  • Drupal 7: 7.x-2.x-dev is stable and only receiving maintenance. 7.x-2.0 is the final version that includes the Drush commands.
  • Drupal 6: 6.x-2.x-dev is stable and no longer supported. For Drush, use 7.x-2.0 as a Drush plugin.
  • Drupal 5: 5.x-1.x-dev is stable and no longer supported.

Drupal UI

Install this module as normal, using the version appropriate for your version of Drupal. For 4.x, use Composer to install the Drupal Code Builder library and other dependencies (see the README for instructions). After installation, run the code analysis on the settings page.

Drush plugin (7.x-2.0 and earlier only)

Install the entire module folder in a place where Drush can find plugins (see Drush documentation for details). It can then be used for any Drupal site that Drush can be used with, independent of Drupal version. Use 7.x-2.0 version as a Drush plugin for version 6 or 7 of Drupal, and use Drush 8 or prior; see the documentation for more details.

Co-maintainers needed: http://drupal.org/node/278908
Invitation for roadmap ideas: http://drupal.org/node/310691

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
15
Tracked since
Oct 2024
Latest release
3 days ago
Releases (12 mo)
9 ▲ from 6
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
4.2.6 Stable 10–11 Aug 28, 2026
4.2.5 Stable 8–11 Aug 4, 2026
4.2.4 Stable 8–11 Jul 21, 2026
4.2.3 Stable 8–11 Jul 2, 2026
4.2.x-dev Dev 8–11 May 15, 2026
4.2.2 Stable 8–11 Mar 15, 2026
4.2.1 Stable 8–11 Jan 26, 2026
4.2.0 Stable 8–11 Jan 26, 2026
4.1.3 Stable 8–11 Sep 10, 2025
4.1.2 Stable 8–11 Aug 22, 2025
4.1.1 Stable 8–11 Jul 21, 2025
4.1.x-dev Dev 8–11 May 15, 2025
4.1.0 Stable 8–11 Apr 26, 2025
4.0.7 Stable 8–11 Mar 28, 2025
4.0.6 Stable 8–11 Oct 19, 2024