nette/di
Nette DI is a fast, configurable dependency injection container for PHP. Compile-time container generation boosts performance, while extensions, autowiring, and service definitions make complex apps easy to wire. Integrates smoothly with the Nette framework or standalone.
A maintenance release laser-focused on type safety. Static analysis is now mandatory in CI, the codebase ships richer native and PHPDoc types, and the Tracy DI panel got a cleaner Latte rewrite. No behavioral changes – just a sturdier foundation for everything built on top.
Compiler, ContainerLoader, ServiceDefinition and friendsn:attributes for noticeably cleaner Latte syntax[@param](https://github.com/param), [@return](https://github.com/return) and class descriptions across Compiler, Container, ContainerBuilder, Resolver, Helpers, definitions and extensions, giving IDEs and static analyzers far more to work withReflectionParameter::getDefaultValue() error #315filterArguments() (BC break)Container::getServiceType() ignores dynamically added services (BC break)Container::getByType() fixed cooperation with dynamic factory #314normalizeEntity() fails due to service replacementCompiler::loadDefinitionsFromConfig() expands parameters (after 3399312)changes
create($name) method (BC break)Resolver::autowireArgument() fixed handling of new-initializer with typehint #302NeonAdapter::removeUnderscoreVisitor() checks if key doesn't existgetParameter() #291Helpers::expand() allow concatenation of Statements #288<Type> syntax for autowiring a collection of services (#293)[@self](https://github.com/self) to setup immediatelyinitialize()Resolver::autowireArguments() fixed support for variadicsContainer::getByType() compatibility with PHPStan (#285)Resolver::autowireArguments() fixed support for variadicsv3.0 maintenance has been ended, please update to v 3.1
Adapter::dump() interface methodChanges:
Deprecations:
[@return](https://github.com/return) are deprecatedResolver::resolveEntityType() ignores return types 'object' & 'mixed' #274Resolver::autowireArgument() uses named arguments to skip optional parameters in PHP 8Resolver::autowireArguments() improved support for variadicsautowireArguments()setCreator() & getCreator(), aliases for setFactory() & getFactory()Resolver::autowireArguments() throws an exception when combining a named and positional parameter" #265$params in definitionResolver::autowireArguments() throws an exception when combining a named and positional parameterFactoryDefinition::resolveType() checks for type compatibilityResolver::completeException() truncates but does not remove the class nameHelper::ensureClassType()Reflection::getReturnTypes() etccompatible with PHP 8.0
completeException() appends entity to exception message when type is not knownFor the details you can have a look at the diff.
bool(), int(), float(), string()Helpers::escape()For the details you can have a look at the diff.
findByType()getByName() as alias for getService()For the details you can have a look at the diff.
initialize() methodFor the details you can have a look at the diff.
autowireArguments() fixed counting optional argsautowireArguments() refactoring, added autowireArgument(), Resolver|Container replaced with callbackFor the details you can have a look at the diff.
expand() fixed expansion of dynamic parametersFor the details you can have a look at the diff.
How can I help you explore Laravel packages today?