Changed in version 12.0

The abstract class \TYPO3\CMS\Core\Service\AbstractService has been removed. See Migration.

This document describes the services functionality included in the TYPO3 Core.

The whole Services API works as a registry. Services are registered with a number of parameters, and each service can easily be overridden by another one with improved features or more specific capabilities, for example. This can be achieved without having to change the original code of TYPO3 CMS or of an extension.

Services are PHP classes packaged inside an extension. The usual way to instantiate a class in TYPO3 CMS is:

use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;

$object = GeneralUtility::makeInstance(ContentObjectRenderer::class);

Getting a service instance is achieved using a different API. The PHP class is not directly referenced. Instead a service is identified by its type, sub type and exclude service keys:

// use TYPO3\CMS\Core\Utility\GeneralUtility;

$serviceObject = GeneralUtility::makeInstanceService(
   ['not_used_service_type1', 'not_used_service_type2']

parameters for makeInstanceService:

  • string $serviceType: Type of service (service key)
  • string $serviceSubType (default ''): Sub type like file extensions or similar. Defined by the service.
  • array $excludeServiceKeys (default []): List of service keys which should be excluded in the search for a service. Array.

The same service can be provided by different extensions. The service with the highest priority and quality (more on that later) is chosen automatically for you.

Reasons for using the Services API

Changed in version 12.0

The abstract class \TYPO3\CMS\Core\Service\AbstractService has been removed. See Migration.

The AbstractService has been removed and it is planned to also deprecate the other methods of the Service API in the future. The Service API should only be used for frontend and backend user authentication.