What is dependency injection in Laravel ?

Member

by dejon , in category: Technology , 4 years ago

What is dependency injection in Laravel ?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by oda.tromp , 4 years ago

In software engineering, dependency injection is a technique whereby one object supplies the dependencies of another object. A dependency is an object that can be used (a service). An injection is the passing of a dependency to a dependent object (a client) that would use it. The service is made part of the client’s state. Passing the service to the client, rather than allowing a client to build or find the service, is the fundamental requirement of the pattern.

https://en.wikipedia.org/wiki/Dependency_injection

You can do dependency injection via Constructor, setter and property injection.

Related Threads:

What Are the Best Practices for Writing Secure Oracle Sql Queries?
What is Laravel?
What are traits in Laravel?
Does Laravel support caching?
Which is easier Laravel or Symfony?
What are service providers in Laravel ?