Services - 8.9.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 893

Title File name Summary All service tags
main_content_renderer.wide_modal core/modules/system/tests/modules/dialog_renderer_test/dialog_renderer_test.services.yml Drupal\dialog_renderer_test\Render\MainContent\WideModalRenderer render.main_content_renderer
main_content_view_subscriber core/core.services.yml Drupal\Core\EventSubscriber\MainContentViewSubscriber event_subscriber
media.config_subscriber core/modules/media/media.services.yml Drupal\media\EventSubscriber\MediaConfigSubscriber event_subscriber
media.oembed.iframe_url_helper core/modules/media/media.services.yml Drupal\media\IFrameUrlHelper
media.oembed.provider_repository core/modules/media/media.services.yml Drupal\media\OEmbed\ProviderRepository
media.oembed.resource_fetcher core/modules/media/media.services.yml Drupal\media\OEmbed\ResourceFetcher
media.oembed.url_resolver core/modules/media/media.services.yml Drupal\media\OEmbed\UrlResolver
media_library.opener.editor core/modules/media_library/media_library.services.yml Drupal\media_library\MediaLibraryEditorOpener
media_library.opener.field_widget core/modules/media_library/media_library.services.yml Drupal\media_library\MediaLibraryFieldWidgetOpener
media_library.opener_resolver core/modules/media_library/media_library.services.yml Drupal\media_library\OpenerResolver
media_library.route_subscriber core/modules/media_library/media_library.services.yml Drupal\media_library\Routing\RouteSubscriber event_subscriber
media_library.ui_builder core/modules/media_library/media_library.services.yml Drupal\media_library\MediaLibraryUiBuilder
media_test_ckeditor.route_subscriber core/modules/media/tests/modules/media_test_ckeditor/media_test_ckeditor.services.yml Drupal\media_test_ckeditor\Routing\RouteSubscriber event_subscriber
menu.active_trail core/core.services.yml Drupal\Core\Menu\MenuActiveTrail needs_destruction
menu.default_tree_manipulators core/core.services.yml Drupal\Core\Menu\DefaultMenuLinkTreeManipulators
menu.link_tree core/core.services.yml Drupal\Core\Menu\MenuLinkTree
menu.parent_form_selector core/core.services.yml Drupal\Core\Menu\MenuParentFormSelector
menu.rebuild_subscriber core/core.services.yml Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber event_subscriber
menu.tree_storage core/core.services.yml Drupal\Core\Menu\MenuTreeStorage backend_overridable
menu_link.static.overrides core/core.services.yml Drupal\Core\Menu\StaticMenuLinkOverrides
messenger core/core.services.yml Drupal\Core\Messenger\Messenger
method_filter core/core.services.yml Drupal\Core\Routing\MethodFilter route_filter
method_filter.jsonapi core/modules/jsonapi/jsonapi.services.yml Drupal\jsonapi\Routing\ReadOnlyModeMethodFilter
migrate.lookup core/modules/migrate/migrate.services.yml Drupal\migrate\MigrateLookup
migrate.plugin_event_subscriber core/modules/migrate/migrate.services.yml Drupal\migrate\Plugin\PluginEventSubscriber event_subscriber
migrate.stub core/modules/migrate/migrate.services.yml Drupal\migrate\MigrateStub
migrate_drupal.field_discovery core/modules/migrate_drupal/migrate_drupal.services.yml Drupal\migrate_drupal\FieldDiscovery
migrate_drupal.migration_state core/modules/migrate_drupal/migrate_drupal.services.yml Drupal\migrate_drupal\MigrationState
module_cachebin.cache_bin core/modules/system/tests/modules/module_cachebin/module_cachebin.services.yml Drupal\Core\Cache\CacheBackendInterface cache.bin
module_handler core/core.services.yml Drupal\Core\Extension\ModuleHandler
module_installer core/core.services.yml Drupal\Core\Extension\ModuleInstaller service_collector
module_install_class_loader_test1.event_subscriber core/modules/system/tests/modules/module_install_class_loader_test2/module_install_class_loader_test2.services.yml Drupal\module_install_class_loader_test2\EventSubscriber event_subscriber
module_install_class_loader_test1.event_subscriber core/modules/system/tests/modules/module_install_class_loader_test1/module_install_class_loader_test1.services.yml Drupal\module_install_class_loader_test1\EventSubscriber event_subscriber
module_required_by_themes_uninstall_validator core/core.services.yml Drupal\Core\Extension\ModuleRequiredByThemesUninstallValidator module_install.uninstall_validator
new_dependency_test.alias core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml Alias of new_dependency_test.dependent
new_dependency_test.alias2 core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml Alias of new_dependency_test.alias_dependency
new_dependency_test.alias_dependency core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml Drupal\new_dependency_test\ServiceWithDependency
new_dependency_test.alias_dependency2 core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml Drupal\new_dependency_test\ServiceWithDependency
new_dependency_test.another_service core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml Drupal\new_dependency_test\Service
new_dependency_test.another_service.decorated core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml Drupal\new_dependency_test\Service
new_dependency_test.another_service_two core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml Drupal\new_dependency_test\Service
new_dependency_test.another_service_two.decorated core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml Drupal\new_dependency_test\Service
new_dependency_test.dependent core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml Drupal\new_dependency_test\InjectedService
new_dependency_test.hard_dependency core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml Drupal\new_dependency_test\ServiceWithDependency
new_dependency_test.optional_dependency core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml Drupal\new_dependency_test\ServiceWithDependency
new_dependency_test.recursion core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml Drupal\new_dependency_test\ServiceWithDependency
new_dependency_test.setter_injection core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml Drupal\new_dependency_test\SetterInjection
new_dependency_test_with_service.service core/modules/system/tests/modules/new_dependency_test_with_service/new_dependency_test_with_service.services.yml Drupal\new_dependency_test_with_service\NewService
node.admin_path.route_subscriber core/modules/node/node.services.yml Drupal\node\EventSubscriber\NodeAdminRouteSubscriber event_subscriber
node.grant_storage core/modules/node/node.services.yml Drupal\node\NodeGrantDatabaseStorage backend_overridable

Other projects


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