本次说明代码

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/ $app = require_once __DIR__.'/../bootstrap/app.php';

主要实现的功能

  1.实例化  Illuminate\Foundation\Application类

  2.初始化基础路径

  3.基本容器(app,Container)和对于类的绑定

  4.基础服务的注册(事件服务EventServiceProvider  日志服务LogServiceProvider  路由服务RoutingServiceProvider)

  5.别名的注册(vendor/laravel/framework/src/Illuminate/Foundation/Application.php文件中的 registerCoreContainerAliases 方法)


流程图


代码

<?php

/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/ /**
* 对于其中的instance register singleton 方法到时候单独拎出来说明
*
* 1.设置基础路径
* 2.使用instance 方法 绑定app 和Illuminate\Foundation\Application类的关系
* 3.使用instance 方法 绑定Container 和Illuminate\Foundation\Application类的关系
* 4.app变量中注册事件服务EventServiceProvider
* 5.app变量中注册日志服务LogServiceProvider
* 6.app变量中注册路由服务RoutingServiceProvider
* 7.别名的注册(vendor/laravel/framework/src/Illuminate/Foundation/Application.php文件中的 registerCoreContainerAliases 方法)
*/
$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
); /*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/ /**
* 把App\Http\Kernel::class 类下的参数 映射到lluminate\Contracts\Http\Kernel::class类中
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
); /**
* 把App\Console\Kernel::class 类下的参数 映射到Illuminate\Contracts\Console\Kernel::class类中
*/
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
); /**
* 把App\Exceptions\Handler::class 类下的参数 映射到Illuminate\Contracts\Debug\ExceptionHandler::class类中
*/
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
); /*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/ return $app;

Laravel (5.5.33) 加载过程(二)的更多相关文章

  1. Laravel (5.5.33) 加载过程(一)

    说明:  由于公司项目使用Laravel 框架  也是第一次接触此框架  作为一个新手 记录使用过程的一些事情  以及对于框架源码分析的记录  整理自己的思路 也希望对大家有帮助  如果那里不对的地方 ...

  2. Laravel (5.5.33) 加载过程---instance方法(二)

    在bootstrap/app.php /** * 对于其中的instance register singleton 方法到时候单独拎出来说明 * * 1.设置基础路径 * 2.使用instance 方 ...

  3. Laravel (5.5.33) 加载过程---make方法(四)

    /** * Resolve the given type from the container. * * @param string $abstract * @return mixed */ publ ...

  4. spring容器启动的加载过程(二)

    第六步: public abstract class AbstractApplicationContext extends DefaultResourceLoader implements Confi ...

  5. JAVA-大白话探索JVM-类加载过程(二)

    首先我们知道JVM是什么以及类加载器的作用 不清楚的可以看看JAVA-大白话探索JVM-类加载器(一) 现在我们来摸索下类的加载过程 首先,我们将类加载过程分为三步走 装载 链接 初始化 其中 链接 ...

  6. 工厂模式模拟Spring的bean加载过程

    一.前言    在日常的开发过程,经常使用或碰到的设计模式有代理.工厂.单例.反射模式等等.下面就对工厂模式模拟spring的bean加载过程进行解析,如果对工厂模式不熟悉的,具体可以先去学习一下工厂 ...

  7. linux内核启动以及文件系统的加载过程

    Linux 内核启动及文件系统加载过程 当u-boot 开始执行 bootcmd 命令,就进入 Linux 内核启动阶段.普通 Linux 内核的启动过程也可以分为两个阶段.本文以项目中使用的 lin ...

  8. JVM——类的加载过程

    附一张图方便理解,一个类的执行过程 类的加载过程,简明的来说 类装饰器就是寻找类的字节码文件并构造出类在JVM内部表示的对象组件.在Java中,类装载器把一个类装入JVM中,要经过以下步骤: 装载:查 ...

  9. (转)JVM类生命周期概述:加载时机与加载过程

    原文地址: http://blog.csdn.net/justloveyou_/article/details/72466105 JVM类加载机制主要包括两个问题:类加载的时机与步骤 和 类加载的方式 ...

随机推荐

  1. 负载均衡之nginx+consul(自动更新路由)

    前几篇先是记载了如何通过nginx配置服务负载均衡,后面记载了如何通过 ocelot 配置 服务负载均衡,分别介绍了用webapi注册服务以及配置文件注册服务,通过ocelot webapi + co ...

  2. RequestMapping_请求参数&请求头

    params和headers支持简单的表达式: --param1:表示请求必须包含名为param1的请求参数. --!param1:表示请求不能包含名为param1的请求参数. --param1 != ...

  3. Java基础学习总结(87)——坚持写Java等技术类博客的好处

    1.加深对技术点的理解 每天写博客,可以加深对技术点的理解,假如工作中,对某个技术点运用的不熟,当你通过博客的形式写出来,这个过程中,遇到不懂的知识点,你就会查阅相关的资料,弄明白他. 2.自己日后用 ...

  4. D - Guess UVALive - 4255 拓扑排序

    Given a sequence of integers, a1, a2, . . . , an, we define its sign matrix S such that, for 1 ≤ i ≤ ...

  5. 玲珑杯 ACM Round #12

    A =w= B 占坑 C 题意:有长度为n的序列A和长度为n的序列W,以及一个G,对于Ui,1<=Ui<=Wi,求Σgcd(Ai,Ui)=G的方案数,n<=1e3,Ai<=1e ...

  6. tomcat上传图片失败

    今天,突然遇到个奇怪的问题,tomcat上传图片时好时坏,经查线上四台服务有一台服务器硬盘满了. 解决一下硬盘空间的问题,有好使了,那么图片上传通过流写到远程对象存储服务中,并没有落盘和硬盘满有哪些关 ...

  7. Django搭建简单的站点

    1.首先.新建一个项目(project), 名称为 mysite django-admin startproject mysite(假设 django-admin 不行,请用 django-admin ...

  8. LeetCode 781. Rabbits in Forest (森林中的兔子)

    题目标签:HashMap 题目给了我们一组数字,每一个数字代表着这只兔子说 有多少只一样颜色的兔子. 我们把每一个数字和它出现的次数都存入map.然后遍历map,来判断到底有多少个一样颜色的group ...

  9. LeetCode 1002. Find Common Characters (查找常用字符)

    题目标签:Array, Hash Table 题目给了我们一个string array A,让我们找到common characters. 建立一个26 size 的int common array, ...

  10. word2vec 中的数学原理具体解释(六)若干源代码细节

      word2vec 是 Google 于 2013 年开源推出的一个用于获取 word vector 的工具包,它简单.高效,因此引起了非常多人的关注.因为 word2vec 的作者 Tomas M ...