0

In symfony framework service's is the same depedency injection ?

What is the difference beetwen service container as Dependency Injection ?

webwinner
  • 87
  • 2
  • 8
  • Consider getting someone to help you translate your question. What you posted makes no sense at all. – Cerad Oct 18 '17 at 22:19

3 Answers3

1

service container as Dependency Injection is a concept for applications developer. Each langugage paradigm as Java, Python or PHP has a service container (DI for Dependency Injection).

For the framework PHP Symfony it tells that Service Container (or just service). In DI concept you can easily delete the contain. It's a obviousness. Because all DI (Java, Python, etc...) live into a container or just a context.

If you already know language that Java and You want to know how symfony manage DI then I just says :"the service" in symfony is the concept of DI for this framework in PHP language.

You can read this post : What is Dependency Injection

miltone
  • 4,416
  • 11
  • 42
  • 76
0

There's pretty much a direct answer in the Symfony docs:

The DependencyInjection component implements a PSR-11 compatible service container that allows you to standardize and centralize the way objects are constructed in your application.

Also, take a look at the Service Container docs.

ccKep
  • 5,786
  • 19
  • 31
0

You could probably quibble with this but:

  • Dependency injection is a design pattern that you use when writing classes, in which depended upon objects are injected into the instance using a constructor or setter. It is more a concept that you use when thinking about how to write code, but doesn't do anything by itself.
  • A service container is an actual thing that is instantiated and creates objects for use in your application. Use of a SC is a design pattern, but the SC is itself instantiated and does things for your application.
  • They are related in that the usefulness of a Service Container is (imo) maximized when it is creating objects that leverage the concept of Dependency Injection.
Isaac
  • 1,505
  • 15
  • 8