Services - 9.5.x - drupal

Primary tabs

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 905

Title File name Summary All service tags
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.entity core/core.services.yml Drupal\Core\Cache\CacheBackendInterface cache.bin
cache.jsonapi_memory core/modules/jsonapi/jsonapi.services.yml Drupal\Core\Cache\MemoryCache\MemoryCache
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
cache.menu core/core.services.yml Drupal\Core\Cache\CacheBackendInterface cache.bin
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.render core/core.services.yml Drupal\Core\Cache\CacheBackendInterface cache.bin
cache.rest core/modules/rest/rest.services.yml Drupal\Core\Cache\CacheBackendInterface cache.bin
cache.static core/core.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.cookies core/core.services.yml Drupal\Core\Cache\Context\CookiesCacheContext 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.headers core/core.services.yml Drupal\Core\Cache\Context\HeadersCacheContext cache.context
cache_context.ip core/core.services.yml Drupal\Core\Cache\Context\IpCacheContext cache.context
cache_context.languages core/core.services.yml Drupal\Core\Cache\Context\LanguagesCacheContext 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.protocol_version core/core.services.yml Drupal\Core\Cache\Context\ProtocolVersionCacheContext cache.context
cache_context.request_format core/core.services.yml Drupal\Core\Cache\Context\RequestFormatCacheContext cache.context
cache_context.route core/core.services.yml Drupal\Core\Cache\Context\RouteCacheContext cache.context
cache_context.route.book_navigation core/modules/book/book.services.yml Drupal\book\Cache\BookNavigationCacheContext cache.context
cache_context.route.menu_active_trails core/core.services.yml Drupal\Core\Cache\Context\MenuActiveTrailsCacheContext cache.context
cache_context.route.name core/core.services.yml Drupal\Core\Cache\Context\RouteNameCacheContext 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.session core/core.services.yml Drupal\Core\Cache\Context\SessionCacheContext cache.context
cache_context.session.exists core/core.services.yml Drupal\Core\Cache\Context\SessionExistsCacheContext cache.context
cache_context.theme core/core.services.yml Drupal\Core\Cache\Context\ThemeCacheContext cache.context
cache_context.timezone core/core.services.yml Drupal\Core\Cache\Context\TimeZoneCacheContext cache.context
cache_context.url core/core.services.yml Drupal\Core\Cache\Context\UrlCacheContext cache.context
cache_context.url.path core/core.services.yml Drupal\Core\Cache\Context\PathCacheContext cache.context
cache_context.url.path.is_front core/core.services.yml Drupal\Core\Cache\Context\IsFrontPathCacheContext cache.context
cache_context.url.path.parent core/core.services.yml Drupal\Core\Cache\Context\PathParentCacheContext cache.context
cache_context.url.query_args core/core.services.yml Drupal\Core\Cache\Context\QueryArgsCacheContext cache.context
cache_context.url.query_args.pagers core/core.services.yml Drupal\Core\Cache\Context\PagersCacheContext cache.context
cache_context.url.site core/core.services.yml Drupal\Core\Cache\Context\SiteCacheContext cache.context
cache_context.user core/core.services.yml Drupal\Core\Cache\Context\UserCacheContext cache.context
cache_context.user.is_super_user core/core.services.yml Drupal\Core\Cache\Context\IsSuperUserCacheContext cache.context
cache_context.user.node_grants core/modules/node/node.services.yml Drupal\node\Cache\NodeAccessGrantsCacheContext cache.context
cache_context.user.permissions core/core.services.yml Drupal\Core\Cache\Context\AccountPermissionsCacheContext cache.context
cache_context.user.roles core/core.services.yml Drupal\Core\Cache\Context\UserRolesCacheContext 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
cache_contexts_manager core/core.services.yml Drupal\Core\Cache\Context\CacheContextsManager
cache_factory core/core.services.yml Drupal\Core\Cache\CacheFactory
cache_router_rebuild_subscriber core/core.services.yml Drupal\Core\EventSubscriber\CacheRouterRebuildSubscriber event_subscriber
cache_tags.invalidator core/core.services.yml Drupal\Core\Cache\CacheTagsInvalidator service_collector

Other projects


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