Skip to main content
Home
Drupal life hacks

Main navigation

  • Drupal
  • React
  • WP
  • Contact
  • About
User account menu
  • Log in

Breadcrumb

  1. Home

Creating a Drupal Module with Drush

By admin, 19 May, 2024

To create a Drupal module using Drush, follow these steps:

1. Install Drush: Make sure Drush is installed on your system. You can install it globally via Composer:

  bash

  composer global require drush/drush

2. Navigate to your Drupal project: Open your terminal and navigate to the root directory of your Drupal project.

3. Create the module: Use Drush to generate the module scaffold:

  bash

  drush generate module

4. Provide module details: Follow the prompts to provide details like module name, machine name, module path, and description.

Here is an example of how the prompts might look:

- Module name: example_module
- Module machine name: example_module
- Module path: modules/custom
- Module description: An example module created with Drush.

After completing the prompts, Drush will create the necessary files and directories for your new module in the specified path. You can then start adding your custom code to the generated files.

Tags

  • #Drupal Planet
  • Drush

Comments

About text formats

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
Powered by Drupal