Samples you've provided reflect totally different approaches (I've left class naming same as you have):
// App/Controllers/HomeController.php
use App\Views\HomeView;
class HomeController {
private $view;
public function __construct() {
$this->view = new HomeView();
}
}
This is not dependency injection, you create the stuff your class depends on inside the class.
Compare to:
// App/Controllers/HomeController.php
use App\Views\HomeView;
class HomeController {
private $view;
public function __construct(HomeView $view) {
$this->view = $view;
}
}
This is actually dependecy injection: whatever your class needs is created outside of the class and passed to it via constructor (in this particular case).
Some tool (dependency injection container) may or may not be used to manage the dependencies depending on your case.
To get some more details please see the article https://martinfowler.com/articles/injection.html by Martin Fowler and search here on SO - the topic is extensively covered (What is dependency injection?, What is Dependency Injection?, When to use Dependency Injection).