Attention
TYPO3 v8 has reached its end-of-life March 31st, 2020 and is not maintained by the community anymore. Looking for a stable version? Use the version switch on the top left.
There is no further ELTS support. It is recommended that you upgrade your project and use a supported version of TYPO3.
Singletons¶
TYPO3 supports singleton patterns for classes. Singletons are
instantiated only once per HTTP request regardless of the number of
calls to GeneralUtility::makeInstance()
. To use a singleton
pattern, a class must implement the SingletonInterface
:
namespace Vendor\MyNamespace;
class MySingletonClass implements \TYPO3\CMS\Core\SingletonInterface
{
…
}
This interface has no methods to implement.