How to Use Drush Generate plugin:manager to Scaffold Custom Plugin Managers in Drupal

SmartLinker AI for Drupal Automates Internal Linking for SEO and Content Efficiency

In this follow-up to last week’s guide on creating custom plugins, Jo Fitzgerald demonstrates how to scaffold a custom plugin manager in Drupal using drush generate plugin:manager (tested with Drush 13.6.2). The command prompts for module machine name, plugin type, and discovery method (Annotation, Attribute, YAML, or Hook), with attributes recommended for Drupal 10.2+.

The generator creates all necessary boilerplate, including MyPluginInterface.php, MyPluginPluginBase.php, MyPluginPluginManager.php, a services.yml entry, and an example plugin. The article details which files can be simplified (e.g., removing the default label() method) and how to adapt the attribute definition for real use. jofitz also shows how to run the command non-interactively using --answer options. This practical tutorial helps developers quickly bootstrap plugin managers for contrib or custom modules.

Reference: Drush Generate plugin:manager Walk-Through (18 August 2025)

Disclosure: This content is produced with the assistance of AI.

Disclaimer: The opinions expressed in this story do not necessarily represent that of TheDropTimes. We regularly share third-party blog posts that feature Drupal in good faith. TDT recommends Reader's discretion while consuming such content, as the veracity/authenticity of the story depends on the blogger and their motives. 

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please reach out to us at #thedroptimes channel on Drupal Slack and we will try to address the issue as best we can.

Related Organizations

Related People

Upcoming Events

Latest Opportunities