laravel 重要概念 以及实现方式
Application的初始化
$app = new Illuminate\Foundation\Application(realpath(__DIR__.'/../') );注冊基本的綁定
$this->instance();
將對應的alias注冊到instances數組中
$this->registerBaseBindings();
將app和Container綁定到實例數組中,并且實現方式都是Application的實例
$this->instance('app', $this); $this->instance('Illuminate\Container\Container', $this);注冊基本的服務提供者
$this->register()
將注冊的provider放到$this->serviceProviders[] 中
$this->registerBaseServiceProviders()
將注冊的provider放到$this->serviceProviders[] 中,直接觸發provider中的register()方法,如果應用已經booted,然后還要觸發provider中的boot方法
$this->register(new EventServiceProvider($this)); $this->register(new RoutingServiceProvider($this));注冊核心容器別名
$this->registerCoreContainerAliases()
將類地址注冊到$this->aliases中,why?
facade的實現
就是通過class_alias來實現的類別名
app啟動的時候kernel通過handle,觸發了app中的bootstrapwith,并且觸發了每個列表中類實現中的bootstrap方法
bootstrapwith加載了所有啟動需要的一個列表,
列表中的RegisterFacade中有個bootstrap被觸發,然后AliasLoader加載了config中的aliases別名配置,執行register
register通過autoload注冊,內部實現通過class_alias
helpers輔助函數的加載
通過autoload,加載了autoload_files,然后直接進行了require
return array('1d1b89d124cc9cb8219922c9d5569199' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest.php','0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php','667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php','2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php','5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php','bd9634f2d41831496de0d3dfe4c94881' => $vendorDir . '/symfony/polyfill-php56/bootstrap.php','e7223560d890eab89cda23685e711e2c' => $vendorDir . '/psy/psysh/src/Psy/functions.php','f0906e6318348a765ffb6eb24e0d0938' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/helpers.php','58571171fd5812e6e447dce228f52f4d' => $vendorDir . '/laravel/framework/src/Illuminate/Support/helpers.php', );Hamcrest
這是一個類似c語言的assert.h的一個東西,斷言
/symfony/polyfill-mbstring
? Symfony is a set of PHP Components, a Web Application framework, a Philosophy, and a Community — all working together in harmony. ?
這是一個通過php來實現mbstring擴展的方法集合,如果沒有安裝mbstring擴展,可以通過這個來實現。
/symfony/var-dumper/Resources/functions/dump.php
可以代替var_dump的方法
The VarDumper component provides mechanisms for walking through any arbitrary PHP variable. Built on top, it provides a better dump() function that you can use instead of var_dump.
/swiftmailer/swiftmailer/lib/swift_required.php
發送郵件用的類
Free Feature-rich PHP Mailer
Swift Mailer integrates into any web app written in PHP 5, offering a flexible and elegant object-oriented approach to sending emails with a multitude of features.
Send emails using SMTP, sendmail, postfix or a custom Transport implementation of your own
Support servers that require username & password and/or encryption
Protect from header injection attacks without stripping request data content
Send MIME compliant HTML/multipart emails
Use event-driven plugins to customize the library
Handle large attachments and inline/embedded images with low memory use
paragonie/random_compat/lib/random.php
沒找到相應的說明,但是應該是生成一個隨機數
/symfony/polyfill-php56/bootstrap.php
一個hash_equals和ldap_escape 不過不知道是啥意思
什么是時序攻擊?什么是ldap?
/psy/psysh/src/Psy/functions.php
一個交互控制臺
總結
以上是生活随笔為你收集整理的laravel 重要概念 以及实现方式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: openstack基于mysql的问题修
- 下一篇: golang sync WaitGrou