Answer the question
In order to leave comments, you need to log in
How to understand laravel structure?
Who can help with understanding the structure of Laravel 5.1. I can't figure out what facades, containers, service providers are. How they are located in namespaces.
Links to articles if possible. Can English. Or someone in brief in an understandable language write.
Answer the question
In order to leave comments, you need to log in
You should read about namespaces separately, in the language specification. Simply put, it is a way to associate a class with a file in the file system. You don't need to include the file, you just refer to the class by namespace, the file is included by itself.
A facade is a way to refer to a class as if it were static. To do this, when "creating" (or rather registering) the facade, the code for creating an instance of the class is registered, and then when SomeClass::method() is called, the framework creates the SomeClass class using this code and calls the method() method. laravel.su/docs/5.0/facades
A service provider is a class that initializes some part of the Laravel application - registering facades, view folders, configs, in general, everything like that. One service provider would be enough, but there are many of them, because it is more convenient to initialize a module, package or logical part of the application in a separate class, rather than adding everything to an existing one. laravel.su/docs/5.0/providers
The Laravel service container, with the help of which (and not with the help of the new operator) all classes in the framework are created, essentially does not differ from the same Falcon one: laravel.su/docs/5.0/container. It is needed to implement DI, i.e. when creating a certain class, for example, a controller, go through the arguments of methods, see what classes are supplied as input, create instances of these classes and actually supply them as input.
You do not need to understand Laravel, but read about patterns and study/understand how OO Architecture works.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question