Hello Drupal Community,

I’m a new Drupal developer and would like to learn how to create a custom module in Drupal 9/10. Could someone guide me through the basic steps or share a reliable tutorial?

Here’s what I’ve tried so far:

  1. Created a folder under /modules/custom/my_module.

  2. Added a my_module.info.yml file with basic details.

  3. Created a my_module.module file with a simple hook.

However, my module isn’t appearing in the Extend list. Am I missing something? Any advice or resources would be greatly appreciated!

Comments

wombatbuddy’s picture

You can generate a custom module with the following Drush command:
drush generate module
And then install the module using the following command:
drush en -y [module_name]
Also, you may play with the Module Builder module.

Here is a one tutorial "Creating modules" (you can find others on youtube).

tolstoydotcom’s picture

In the specific case of what you have now, did you clear cache? Can the web server read the directory/files? Start with an info.yml file from another module and modify it, your YML might be wrong.

Available for paid support, module development, migrations, consulting...