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

Name Filesort descending Class Tags
http_middleware.kernel_pre_handle core/core.services.yml Drupal\Core\StackMiddleware\KernelPreHandle http_middleware
twig.loader.filesystem core/core.services.yml Drupal\Core\Template\Loader\FilesystemLoader twig.loader
cache_context.user core/core.services.yml Drupal\Core\Cache\Context\UserCacheContext cache.context
http_middleware.session core/core.services.yml Drupal\Core\StackMiddleware\Session http_middleware
twig.loader.theme_registry core/core.services.yml Drupal\Core\Template\Loader\ThemeRegistryLoader twig.loader
cache_context.user.permissions core/core.services.yml Drupal\Core\Cache\Context\AccountPermissionsCacheContext cache.context
http_middleware.cors core/core.services.yml Asm89\Stack\Cors http_middleware
twig.loader.string core/core.services.yml Drupal\Core\Template\Loader\StringLoader twig.loader
cache_context.user.roles core/core.services.yml Drupal\Core\Cache\Context\UserRolesCacheContext cache.context
psr7.http_foundation_factory core/core.services.yml Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory
element_info core/core.services.yml Alias of plugin.manager.element_info
cache_context.user.is_super_user core/core.services.yml Drupal\Core\Cache\Context\IsSuperUserCacheContext cache.context
Symfony\Bridge\PsrHttpMessage\HttpFoundationFactoryInterface core/core.services.yml
file.htaccess_writer core/core.services.yml Drupal\Core\File\HtaccessWriter
cache_context.languages core/core.services.yml Drupal\Core\Cache\Context\LanguagesCacheContext cache.context
psr17.server_request_factory core/core.services.yml GuzzleHttp\Psr7\HttpFactory
Drupal\Core\File\HtaccessWriterInterface core/core.services.yml
cache_context.theme core/core.services.yml Drupal\Core\Cache\Context\ThemeCacheContext cache.context
Psr\Http\Message\ServerRequestFactoryInterface core/core.services.yml
file.mime_type.guesser core/core.services.yml Drupal\Core\File\MimeType\MimeTypeGuesser service_collector
cache_context.timezone core/core.services.yml Drupal\Core\Cache\Context\TimeZoneCacheContext cache.context
psr17.stream_factory core/core.services.yml GuzzleHttp\Psr7\HttpFactory
file.mime_type.guesser.extension core/core.services.yml Drupal\Core\File\MimeType\ExtensionMimeTypeGuesser mime_type_guesser
cache_factory core/core.services.yml Drupal\Core\Cache\CacheFactory
Psr\Http\Message\StreamFactoryInterface core/core.services.yml
render_placeholder_generator core/core.services.yml Drupal\Core\Render\PlaceholderGenerator
Drupal\Core\Cache\CacheFactoryInterface core/core.services.yml
psr17.uploaded_file_factory core/core.services.yml GuzzleHttp\Psr7\HttpFactory
Drupal\Core\Render\PlaceholderGeneratorInterface core/core.services.yml
cache_contexts_manager core/core.services.yml Drupal\Core\Cache\Context\CacheContextsManager
Psr\Http\Message\UploadedFileFactoryInterface core/core.services.yml
render_cache core/core.services.yml Drupal\Core\Render\PlaceholderingRenderCache
Drupal\Core\Cache\Context\CacheContextsManager core/core.services.yml
psr17.response_factory core/core.services.yml GuzzleHttp\Psr7\HttpFactory
Drupal\Core\Render\RenderCacheInterface core/core.services.yml
cache_tags.invalidator core/core.services.yml Drupal\Core\Cache\CacheTagsInvalidator service_collector
Psr\Http\Message\ResponseFactoryInterface core/core.services.yml
renderer core/core.services.yml Drupal\Core\Render\Renderer
Drupal\Core\Cache\CacheTagsInvalidatorInterface core/core.services.yml
psr7.http_message_factory core/core.services.yml Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory
Drupal\Core\Render\RendererInterface core/core.services.yml
cache_tags.invalidator.checksum core/core.services.yml Drupal\Core\Cache\DatabaseCacheTagsChecksum cache_tags_invalidator, backend_overridable
Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface core/core.services.yml
early_rendering_controller_wrapper_subscriber core/core.services.yml Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber
Drupal\Core\Cache\CacheTagsChecksumInterface core/core.services.yml
language_manager core/core.services.yml Drupal\Core\Language\LanguageManager
html_response.placeholder_strategy_subscriber core/core.services.yml Drupal\Core\EventSubscriber\HtmlResponsePlaceholderStrategySubscriber
cache.backend.chainedfast core/core.services.yml Drupal\Core\Cache\ChainedFastBackendFactory
Drupal\Core\Language\LanguageManagerInterface core/core.services.yml
placeholder_strategy core/core.services.yml Drupal\Core\Render\Placeholder\ChainedPlaceholderStrategy service_collector

Pages

Other projects