ObjectFactory

  creates objects from specifications (via  or  ). This format is used by certain configuration settings (such as $wgMWLoggerDefaultSpi or $wgSessionProviders). A typical specification looks like this: which is the specification for.

Other options include:

With Dependency Injection
Starting with MediaWiki 1.34, ObjectFactory now supports creating classes with services specified in the spec. To use ObjectFactory to create classes that need services, you'll need to use the ObjectFactory service, and call the  method.

For non-MediaWiki uses, an ObjectFactory instance can be created with a PSR-11 Container interface that will be used to retrieve the services from.