S
S
Stanislav Pochepko2015-09-08 13:43:57
Laravel
Stanislav Pochepko, 2015-09-08 13:43:57

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

5 answer(s)
A
ajaxtelamonid, 2015-09-09
@DJZT

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.

J
JohnDaniels, 2015-09-08
@JohnDaniels

x_cef55f6c.jpg

D
Denis, 2015-09-08
@prototype_denis

With pictures here...
https://sourcemaking.com/design_patterns

S
Stanislav, 2015-09-08
@mzcoding

You do not need to understand Laravel, but read about patterns and study/understand how OO Architecture works.

D
Dimonchik, 2015-09-08
@dimonchik2013

so Laralvel boasts of its documentation
like https://laravel.ru/docs/v5/facades
but in Falcon it seemed to me more intelligible at one time
https://docs.phalconphp.com/ru/latest/reference/di...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question