We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
随着前面 《02. Kernel Handle解析》 和 《03. ServiceProvider Register 解析》 的结束,我们接下来要分析的便是 启动服务提供者 这个步骤。
laravel/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php
Lines 1 to 19 in d081c91
同 ServiceProvider Register 一样的,在 BootProviders 中也是调用了 Illuminate\Foundation\Application::boot()
ServiceProvider Register
Illuminate\Foundation\Application::boot()
laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php
Lines 759 to 782 in d081c91
首先判断是否 boot 过。
然后通过触发 $bootingCallbacks 钩子
Lines 823 to 834 in d081c91
$bootingCallbacks 是来自 02. HTTP Kernel Handle解析 登记的闭包,主要是服务于声明了 $defer = true 的服务提供者。
$defer = true
然后依次遍历 $this->serviceProviders 执行 Illuminate\Foundation\Application::bootProvider()
$this->serviceProviders
Illuminate\Foundation\Application::bootProvider()
Lines 784 to 795 in d081c91
其实就是运行一遍 ServiceProvider 的 boot 方法
接着将 Illuminate\Foundation\Application::$boot 设置为 true
Illuminate\Foundation\Application::$boot
最后触发 bootedCallbacks 钩子
The text was updated successfully, but these errors were encountered:
No branches or pull requests
代码
laravel/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php
Lines 1 to 19 in d081c91
同
ServiceProvider Register
一样的,在 BootProviders 中也是调用了Illuminate\Foundation\Application::boot()
laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php
Lines 759 to 782 in d081c91
首先判断是否 boot 过。
然后通过触发 $bootingCallbacks 钩子
laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php
Lines 823 to 834 in d081c91
然后依次遍历
$this->serviceProviders
执行Illuminate\Foundation\Application::bootProvider()
laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php
Lines 784 to 795 in d081c91
其实就是运行一遍 ServiceProvider 的 boot 方法
接着将
Illuminate\Foundation\Application::$boot
设置为 true最后触发 bootedCallbacks 钩子
The text was updated successfully, but these errors were encountered: