Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v11 here: TYPO3 ELTS.
Introducing a new service type
Deprecated since version 11.3
The abstract class \TYPO3\
has been
deprecated. See Migration.
Every service belongs to a given service type. A service type is represented by a key, just like an extension key. In the examples above there were mentions of the "auth" and "metaExtract" service types.
Each service type will implement its own API corresponding to the task
it is designed to handle. For example the "auth" service type requires
the two methods get
and auth
. If you
introduce a new service type you should think well about its API
before starting development. Ideally you should discuss with other
developers. Services are meant to be reusable. A badly designed
service that is used only once is a failed service.
You should plan to provide an interface and/or base class for your new service type. It is then easier to develop services based on this type as you can start by extending the base class. You should also provide a documentation, that describes the API. It should be clear to other developers what each method of the API is supposed to do.