Services - 11.x - drupal

Introduction to services

A "service" (such as accessing the database, sending email, or translating user interface text) can be defined by a module or Drupal core. Defining a service means giving it a name and designating a default class to provide the service; ideally, there should also be an interface that defines the methods that may be called. Services are collected into the Dependency Injection Container, and can be overridden to use different classes or different instantiation by modules. See the Services and Dependency Injection Container topic for details.

Some services have tags, which are defined in the service definition. Tags are used to define a group of related services, or to specify some aspect of how the service behaves. See the Service Tags topic for more information.

See also

Services and Dependency Injection Container

Service Tags

File

core/core.api.php, line 900

Title File name Summary All service tags
cache.backend.null sites/development.services.yml Drupal\Core\Cache\NullBackendFactory
cache.discovery_migration core/modules/migrate/migrate.services.yml Drupal\Core\Cache\CacheBackendInterface cache.bin
cache.dynamic_page_cache core/modules/dynamic_page_cache/dynamic_page_cache.services.yml Drupal\Core\Cache\CacheBackendInterface cache.bin
cache.jsonapi_memory core/modules/jsonapi/jsonapi.services.yml Drupal\Core\Cache\MemoryCache\MemoryCacheInterface cache.bin.memory
cache.jsonapi_normalizations core/modules/jsonapi/jsonapi.services.yml Drupal\Core\Cache\CacheBackendInterface cache.bin
cache.jsonapi_resource_types core/modules/jsonapi/jsonapi.services.yml Drupal\Core\Cache\BackendChain cache.bin.memory
cache.migrate core/modules/migrate/migrate.services.yml Drupal\Core\Cache\CacheBackendInterface cache.bin
cache.page core/modules/page_cache/page_cache.services.yml Drupal\Core\Cache\CacheBackendInterface cache.bin
cache.rest core/modules/rest/rest.services.yml Drupal\Core\Cache\CacheBackendInterface cache.bin
cache.toolbar core/modules/toolbar/toolbar.services.yml Drupal\Core\Cache\CacheBackendInterface cache.bin
cache_context.config_override_integration_test core/modules/config/tests/config_override_integration_test/config_override_integration_test.services.yml Drupal\config_override_integration_test\Cache\ConfigOverrideIntegrationTestCacheContext cache.context
cache_context.entity_test_view_grants core/modules/system/tests/modules/entity_test/entity_test.services.yml Drupal\entity_test\Cache\EntityTestViewGrantsCacheContext cache.context
cache_context.layout_builder_is_active core/modules/layout_builder/layout_builder.services.yml Drupal\layout_builder\Cache\LayoutBuilderIsActiveCacheContext cache.context
cache_context.pirate_day core/modules/config/tests/config_override_test/config_override_test.services.yml Drupal\config_override_test\Cache\PirateDayCacheContext cache.context
cache_context.route.book_navigation core/modules/book/book.services.yml Drupal\book\Cache\BookNavigationCacheContext cache.context
cache_context.route.name.is_layout_builder_ui core/modules/layout_builder/layout_builder.services.yml Drupal\layout_builder\Cache\LayoutBuilderUiCacheContext cache.context
cache_context.user.node_grants core/modules/node/node.services.yml Drupal\node\Cache\NodeAccessGrantsCacheContext cache.context
cache_context.views_test_cache_context core/modules/views/tests/modules/views_test_data/views_test_data.services.yml Drupal\views_test_data\Cache\ViewsTestCacheContext cache.context
cache_context.workspace core/modules/workspaces/workspaces.services.yml Drupal\workspaces\WorkspaceCacheContext cache.context
ckeditor5.ckeditor5_cache_tag core/modules/ckeditor5/ckeditor5.services.yml Drupal\ckeditor5\EventSubscriber\CKEditor5CacheTag
ckeditor5.smart_default_settings core/modules/ckeditor5/ckeditor5.services.yml Drupal\ckeditor5\SmartDefaultSettings
comment.breadcrumb core/modules/comment/comment.services.yml Drupal\comment\CommentBreadcrumbBuilder breadcrumb_builder
comment.lazy_builders core/modules/comment/comment.services.yml Drupal\comment\CommentLazyBuilders
comment.link_builder core/modules/comment/comment.services.yml Drupal\comment\CommentLinkBuilder
comment.manager core/modules/comment/comment.services.yml Drupal\comment\CommentManager
comment.statistics core/modules/comment/comment.services.yml Drupal\comment\CommentStatistics backend_overridable
config.config_subscriber core/modules/config/config.services.yml Drupal\config\ConfigSubscriber
config_collection_install_test.event_subscriber core/modules/config/tests/config_collection_install_test/config_collection_install_test.services.yml Drupal\config_collection_install_test\EventSubscriber
config_events_test.event_subscriber core/modules/config/tests/config_events_test/config_events_test.services.yml Drupal\config_events_test\EventSubscriber
config_import_test.event_subscriber core/modules/config/tests/config_import_test/config_import_test.services.yml Drupal\config_import_test\EventSubscriber
config_override_integration_test.config_override core/modules/config/tests/config_override_integration_test/config_override_integration_test.services.yml Drupal\config_override_integration_test\CacheabilityMetadataConfigOverride config.factory.override
config_override_test.low_priority_overrider core/modules/config/tests/config_override_test/config_override_test.services.yml Drupal\config_override_test\ConfigOverriderLowPriority config.factory.override
config_override_test.overrider core/modules/config/tests/config_override_test/config_override_test.services.yml Drupal\config_override_test\ConfigOverrider config.factory.override
config_override_test.pirate_day_cacheability_metadata_override core/modules/config/tests/config_override_test/config_override_test.services.yml Drupal\config_override_test\PirateDayCacheabilityMetadataConfigOverride config.factory.override
config_transformer_test.event_subscriber core/modules/config/tests/config_transformer_test/config_transformer_test.services.yml Drupal\config_transformer_test\EventSubscriber
config_translation.access.form core/modules/config_translation/config_translation.services.yml Drupal\config_translation\Access\ConfigTranslationFormAccess access_check
config_translation.access.overview core/modules/config_translation/config_translation.services.yml Drupal\config_translation\Access\ConfigTranslationOverviewAccess access_check
config_translation.route_subscriber core/modules/config_translation/config_translation.services.yml Drupal\config_translation\Routing\RouteSubscriber
config_translation_test_event_subscriber core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.services.yml Drupal\config_translation_test\EventSubscriber\ConfigTranslationTestSubscriber
contact.mail_handler core/modules/contact/contact.services.yml Drupal\contact\MailHandler
content_moderation.config_import_subscriber core/modules/content_moderation/content_moderation.services.yml Drupal\content_moderation\EventSubscriber\ConfigImportSubscriber
content_moderation.moderation_information core/modules/content_moderation/content_moderation.services.yml Drupal\content_moderation\ModerationInformation
content_moderation.route_subscriber core/modules/content_moderation/content_moderation.services.yml Drupal\content_moderation\Routing\ContentModerationRouteSubscriber
content_moderation.state_transition_validation core/modules/content_moderation/content_moderation.services.yml Drupal\content_moderation\StateTransitionValidation
content_moderation.workspace_subscriber core/modules/content_moderation/content_moderation.services.yml Drupal\content_moderation\EventSubscriber\WorkspaceSubscriber
content_translation.delete_access core/modules/content_translation/content_translation.services.yml Drupal\content_translation\Access\ContentTranslationDeleteAccess access_check
content_translation.manager core/modules/content_translation/content_translation.services.yml Drupal\content_translation\ContentTranslationManager
content_translation.manage_access core/modules/content_translation/content_translation.services.yml Drupal\content_translation\Access\ContentTranslationManageAccessCheck access_check
content_translation.overview_access core/modules/content_translation/content_translation.services.yml Drupal\content_translation\Access\ContentTranslationOverviewAccess access_check
content_translation.subscriber core/modules/content_translation/content_translation.services.yml Drupal\content_translation\Routing\ContentTranslationRouteSubscriber

Other projects


Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.