drupal-service-di

Installation
SKILL.md

Drupal Service & Dependency Injection

Always use constructor injection — never use \Drupal:: static calls in classes. Always check the structural index before creating new services to avoid duplicates. Prefer interface type-hints over concrete classes.

Service Definition

# my_module.services.yml
services:
  my_module.content_manager:
    class: Drupal\my_module\ContentManager
    arguments:
      - '@entity_type.manager'
      - '@current_user'
      - '@logger.channel.my_module'
Installs
38
GitHub Stars
18
First Seen
Jul 9, 2026