Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

Awareness

18 sites Security covered
View on drupal.org

This module enhances developer experience by providing traits for commonly used Drupal services. It allows you to easily inject and access services within your custom classes, simplifying development. The module also includes a Drush command to generate awareness traits for your own custom services.

Provides traits and improve DX for commonly-used services.

See the code to see which services are supported.

Example: Add the entity type manager to a service


namespace Drupal\my_module;

use Drupal\awareness\Entity\EntityTypeManagerAwareTrait

/**
 * My service.
 */
class MyService {

  use EntityTypeManagerAwareTrait;

  // Custom code can call $this->getEntityTypeManager() to utilize the service.

}

Creating awareness for custom services

This module provides a Drush code generator to create awareness traits. If your module provides service, run the following to create traits for your services:

drush gen awareness:trait

Creating awareness for core services

A good bit of the commonly-used core services are provided by the traits included in this module. If you come across a core service that is not supported, please open an issue and/or a merge request to add a trait for the service.

Creating awareness for contrib services

This module is not intending to provide awareness for services from other contrib modules--that's their job. If there is a very widely used module that won't provide awareness of its services, we can discuss adding a submodule to this project to provide awareness.

Activity

Total releases
1
First release
Jul 2025
Latest release
11 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Slowing

Releases

Version Type Release date
2.0.8 Stable Jul 24, 2025