Autowiring¶
Autowiring is the ability of the framework to inject dependencies, based on the constructor signature.
Autowiring is based on types, in the signature of the controller.
Autowiring is commonly used in dependency injection, DI containers.
Autowiring reduce boilerplate code, enhance type usage and make refactoring easier.
<?php
class Renderer {
private View $view;
function __construct(View $view) {
$this->view = $view;
}
}
?>
See also Autowiring - php-di and Defining Services Dependencies Automatically (Autowiring).
Related : Dependency Injection, Constructor, Boilerplate, Type System, Refactoring
Related packages : nette/di, php-di/php-di