S
S
Sergey2015-09-08 14:09:02
PHP
Sergey, 2015-09-08 14:09:02

What is a provider in programming?

I often meet classes with the names "EventServiceProvider.php", "AppServiceProvider.php", etc.
Explain in simple terms what is a provider? As I understand it, this is a service provider, a kind of interface for working with other services. Can I call a PDO or ActiveRecord class a provider, or can I call any class a provider?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Dunayevsky, 2015-09-08
@frost18

Typically, a provider is used to encapsulate more complex code, hiding implementation details. It serves as a sort of wrapper, implementing the Facade design pattern .
You copy a file from directory to directory by simply dragging it with the mouse. But how did it happen on the physical level? You do not need to know this, everything is hidden under multiple layers of abstractions.
In order not to think about any low-level things, providers, services, etc. are often introduced. The bottom line is to hide any frequently used complex functions and routine work behind a simple and understandable interface.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question