Skip to main content

Drupal module info file

A .info.yml file (aka. "info yaml file") is an essential part of a Drupal 8+ module, theme, or install profile to store metadata about the project.

These .info.yml files are required to:

  •  Notify Drupal about the existence of a module, theme, or install profile.
  •  Specify if this is a theme, or module. 
  •  Provide information for the Drupal Web UI administration pages. 
  •  Provide criteria to control module activation and deactivation and Drupal version compatibility. 
  •  General administrative purposes in other contexts.

These are the basics you need in place in order to see your module available on Drupal's installation screen. 
For a module called hello_world, here are the contents of hello_world/hello_world.info.yml:

name: Hello World Module
description: Creates a page showing "Hello World".
package: Custom
type: module
core_version_requirement: ^9.4 || ^10

 

Required keys in an info file

  • name: A name for your module. 
  • type: The type of package. For a module info file, specify module. 
  • core_version_requirement: The semantic version(s) of core compatible with your module
  • core (only required for core 8.7.7 and earlier): The version of core the module works with (replaced by core_version_requirement).

 

Optional keys in an info file

  • description: A brief description of its functionality (appears in the module listing on the Extend administrative page)
  • package: Lists the module in a group with value specified. For example, use Custom to group all your custom modules in a group named "Custom" on the Extend page.
  • dependencies: If applicable, provide a list of dependencies required by the module
  • lifecycle: Specify the stability and maintenance status of your module (see below for example values)
  • configure: Specify the name of the route to the module's configuration form (a link labeled "Configure" will appear in the module listing on the Extend page if a valid route is provided here)
  • hidden: (true) Use if you want to hide your module from the list on Extend. Used most often for modules containing automated tests. To override this setting (and list all hidden modules), add $settings['extension_discovery_scan_tests'] = TRUE to your site's settings.php.

 

name: Hello World Module
description: Creates a page showing "Hello World".
package: Custom

type: module
core_version_requirement: ^9.4 || ^10

dependencies:
  - drupal:link
  - drupal:views
  - paragraphs:paragraphs
  - webform:webform (>=6.1.0)

test_dependencies:
 - drupal:image

configure: hello_world.settings
configure_parameters:
  pluginId: hello_world_plugin

php: 8.0

hidden: true
required: true

# Set the module lifecycle status deprecated
lifecycle: deprecated
lifecycle_link: https://www.drupal.org/node/3223395#s-aggregator

# Note: do not add the 'version' or 'project' properties yourself.
# They will be added automatically by the packager on drupal.org.
# version: 1.0
# project: 'hello_world'