PHP 클래스 DI\ContainerBuilder

With the default options, the container created is appropriate for the development environment. Example: $builder = new ContainerBuilder(); $container = $builder->build();
부터: 3.2
저자: Matthieu Napoli ([email protected])
파일 보기 프로젝트 열기: mnapoli/php-di 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( string $containerClass = 'DI\Container' )
addDefinitions ( string | array | DI\Definition\Source\DefinitionSource $definitions ) Add definitions to the container.
build ( ) : Container Build and return a container.
buildDevContainer ( ) : Container Build a container configured for the dev environment.
ignorePhpDocErrors ( boolean $bool ) : ContainerBuilder Enable or disable ignoring phpdoc errors (non-existent classes in @param or @var).
setDefinitionCache ( Doctrine\Common\Cache\Cache $cache ) : ContainerBuilder Enables the use of a cache for the definitions.
useAnnotations ( boolean $bool ) : ContainerBuilder Enable or disable the use of annotations to guess injections.
useAutowiring ( boolean $bool ) : ContainerBuilder Enable or disable the use of autowiring to guess injections.
wrapContainer ( Interop\Container\ContainerInterface $otherContainer ) If PHP-DI's container is wrapped by another container, we can set this so that PHP-DI will use the wrapper rather than itself for building objects.
writeProxiesToFile ( boolean $writeToFile, string | null $proxyDirectory = null ) : ContainerBuilder Configure the proxy generation.

비공개 메소드들

메소드 설명
ensureNotLocked ( )

메소드 상세

__construct() 공개 메소드

public __construct ( string $containerClass = 'DI\Container' )
$containerClass string Name of the container class, used to create the container.

addDefinitions() 공개 메소드

Add definitions to the container.
public addDefinitions ( string | array | DI\Definition\Source\DefinitionSource $definitions )
$definitions string | array | DI\Definition\Source\DefinitionSource Can be an array of definitions, the name of a file containing definitions or a DefinitionSource object.

build() 공개 메소드

Build and return a container.
public build ( ) : Container
리턴 Container

buildDevContainer() 공개 정적인 메소드

Build a container configured for the dev environment.
public static buildDevContainer ( ) : Container
리턴 Container

ignorePhpDocErrors() 공개 메소드

Enable or disable ignoring phpdoc errors (non-existent classes in @param or @var).
public ignorePhpDocErrors ( boolean $bool ) : ContainerBuilder
$bool boolean
리턴 ContainerBuilder

setDefinitionCache() 공개 메소드

Enables the use of a cache for the definitions.
public setDefinitionCache ( Doctrine\Common\Cache\Cache $cache ) : ContainerBuilder
$cache Doctrine\Common\Cache\Cache Cache backend to use
리턴 ContainerBuilder

useAnnotations() 공개 메소드

Disabled by default.
public useAnnotations ( boolean $bool ) : ContainerBuilder
$bool boolean
리턴 ContainerBuilder

useAutowiring() 공개 메소드

Enabled by default.
public useAutowiring ( boolean $bool ) : ContainerBuilder
$bool boolean
리턴 ContainerBuilder

wrapContainer() 공개 메소드

If PHP-DI's container is wrapped by another container, we can set this so that PHP-DI will use the wrapper rather than itself for building objects.
public wrapContainer ( Interop\Container\ContainerInterface $otherContainer )
$otherContainer Interop\Container\ContainerInterface

writeProxiesToFile() 공개 메소드

For dev environment, use writeProxiesToFile(false) (default configuration) For production environment, use writeProxiesToFile(true, 'tmp/proxies')
public writeProxiesToFile ( boolean $writeToFile, string | null $proxyDirectory = null ) : ContainerBuilder
$writeToFile boolean If true, write the proxies to disk to improve performances
$proxyDirectory string | null Directory where to write the proxies
리턴 ContainerBuilder