You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All the compiled definitions will be dumped into a PHP class (the compiled container) which will be written to a file (for example CompiledContainer.php).
At runtime, the container builder will see that the file CompiledContainer.php exists and will load it (instead of loading the definition files). That PHP file may contain a lot of code but PHP's opcode cache will cache that class in memory (remember to use opcache in production). When a definition needs to be resolved, PHP-DI will simply execute the compiled code and return the created instance.
The text was updated successfully, but these errors were encountered:
How it works
Pluf DI will read definitions from your configuration. When the container is compiled, PHP code will be generated based on those definitions.
For example let's take the definition for creating an object:
This definition will be compiled to PHP code similar to this:
All the compiled definitions will be dumped into a PHP class (the compiled container) which will be written to a file (for example
CompiledContainer.php
).At runtime, the container builder will see that the file
CompiledContainer.php
exists and will load it (instead of loading the definition files). That PHP file may contain a lot of code but PHP's opcode cache will cache that class in memory (remember to use opcache in production). When a definition needs to be resolved, PHP-DI will simply execute the compiled code and return the created instance.The text was updated successfully, but these errors were encountered: