Module Template
This is a basic Drupal module template. To use it:
- Copy this directory to your Drupal installation:
modules/custom/yourmodulename/ - Rename files from
MODULENAME.*toyourmodulename.* - Replace all instances of
MODULENAMEwith your module's machine name (lowercase, underscores) - Replace all instances of
MODULELABELwith your module's human-readable name - Customize the module as needed
Files Included
MODULENAME.info.yml- Module metadataMODULENAME.module- Hook implementationsMODULENAME.routing.yml- Route definitionssrc/Controller/ExampleController.php- Example controller
Directory Structure
MODULENAME/
├── MODULENAME.info.yml
├── MODULENAME.module
├── MODULENAME.routing.yml
└── src/
└── Controller/
└── ExampleController.php
Next Steps
After creating your module:
- Enable it:
ddev drush en MODULENAME -y - Clear cache:
ddev drush cr - Visit your route:
/MODULENAME/example