Title here
Summary here
One of the advanced features of the Norvica DI Container is the ability to compile your container configuration. This means transforming the PHP code that defines your services into a highly optimized PHP class, resulting in significantly faster container performance.
To compile your container, use the Configurator::snapshot()
method:
How It Works Under the Hood:
snapshot()
method analyzes your container.php
configuration file, identifying services,
dependencies, and their relationships.MyCompiledContainer
in the example) that includes the logic to create
and configure all your services in a highly optimized way.__DIR__ . '/../var/cache'
). On subsequent
runs, the container will load the cached class instead of re-analyzing the configuration.When you make changes to your configuration file, you’ll need to clear the cached compiled container (e.g., by deleting the generated file) to ensure that the new configuration takes effect. Don’t use compiled container in development environment.