It took me an intermittent week to roughly understand the operating mechanism of Laravel. Maybe the basic knowledge of PHP is still not strong enough, and I still don’t understand the source code of Laravel.
First of all, the Laravel documentation is really concise, most of the You can only explore the content yourself `sever.php` This file should be the entry file. Then `require_once` the `public/index.php` file, so start looking at the index.php file.
What I learned from the index.php file is: it contains composer’s autoloader autoload.php, and then an important file `bootstrap/app.php`. This app.php file feels very important. This file returns An app variable, an instance of the Application class.
Then I checked the information and learned that Application is the core server container of Laravel.
What is a server container?
This involves IOC inversion of control. To put it bluntly, the instantiation of a class is managed in this container, and developers only need to get the objects they want to use from this container.
Regarding the service container, Laravel’s official documentation mentions very little, and you can only understand it by checking some other information. This is a relatively good blog post.
laravel study notes
How to create service provider and facade in laravel5
The above is a rough introduction to Laravel, including laravel content. I hope it will be helpful to friends who are interested in PHP tutorials.