Dependency injection tự động cung cấp các dependency cần thiết cho class. Thay vì new UserRepository() bên trong controller, type-hint trong method: public function index(UserRepository $repo) { return $repo->all(); }. Service container của Laravel tự động khởi tạo và inject class.
Lợi ích: dễ test hơn (inject mock repository), coupling lỏng lẻo (đổi implementation mà không sửa controller), code gọn hơn. Laravel xử lý injection tự động cho route controller, middleware, commands. Giúp code linh hoạt và dễ test mà không cần khởi tạo thủ công.