Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Usage Milestone: Time Field for Drupal 8+ Module time_field crossed 10,000 active installs. Usage Milestone: Devel PHP Module devel_php crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Awareness

15 sites Security covered Drupal 10–11
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.

Depends on

Dependencies of the latest stable release

  • file Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Oct 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 2
Maintenance
Active

Releases

Version Type Core Release date
2.0.8 Stable 10–11 Jul 24, 2025
2.0.7 Stable 9–10 Oct 18, 2024