P
P
parensinterneta2019-07-11 07:45:29
Laravel
parensinterneta, 2019-07-11 07:45:29

Where is the boundary between Service Provider and Service Container in Laravel???

Plz help who fumbles in LARAVEL. I study Service-Container and Service-Provider. Everything seems to be clear, but... Where does the Provider and the Container begin and end??? "$this->app(.....) { }" - is app already a Container or still a provider??? or Container is whatever is in the parenthesis inside 'app'. ??? plz help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin B., 2019-07-11
@Kostik_1993

There is no border, because they are different things. The container is the way to access
the Provider is the first thing loaded in your application. In it, you can just bind containers.

N
NubasLol, 2019-07-11
@NubasLol

In essence, a service container is an object that stores services.
Service providers are classes that register services in a container and describe their dependencies.
And then when you write index(Request $request) in the controller, Laravel receives this class from the container, which will be created with all the necessary dependencies, and passes it to the method.
This works on reflection
https://www.php.net/manual/en/book.reflection.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question