本次说明代码

/*
|--------------------------------------------------------------------------
| 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. flask——CSRFToken保护

    根据 csrf_token 校验原理,具体操作步骤有以下几步: 1.后端生成 csrf_token 的值,在前端请求登录或者注册界面的时候将值传给前端,传给前端的方式可能有以下两种: 在模板中的 Fr ...

  2. 洛谷P1028数的计算

    https://www.luogu.org/problemnew/show/P1028 只用递归会超时,需要用递归型动规,用一个数组保存已经算过的值,避免重复计算. 求数字为n的方案数的最优子结构为: ...

  3. RequestMapping_请求方式

    [映射请求参数.请求方法或请求头] 1.@RequestMapping 除了可以使用请求URL 映射请求外,还可以使用请求方法.请求参数及请求头映射请求. 2.@RequestMapping 的val ...

  4. MySQL出现:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure Last packet sent to the server was 0 ms ago.

    1.首先检查生产环境的机器是否ping的通和telnet的通数据库 2.排查数据库连接的参数 3.看数据量是否很大 参考: http://blog.csdn.net/sclxf/article/det ...

  5. Ubuntu 16.04监控网络带宽软件

    1.系统监控器已经自带了默认的监控功能,包括CPU.内存.带宽.进程等,但带宽的一些详情不能显示出来. 2.使用top命令进行监控进程 sudo top 3.安装Indicator-sysmonito ...

  6. 网卡MAC地址异常会导致无接受数据包,表现为只有发送没有接收

    遇到一个诡异的问题,一块4口博通千兆网卡中两个正常,两个怎么都没有接受,但是博通的程序网卡自检没有任何问题,最后发现是MAC地址的原因.需要将地址改为正常MAC方可正常通讯. 感觉应该是交换机丢弃了M ...

  7. HDUOJ--2121--Ice_cream’s world II【朱刘算法】不定根最小树形图

    链接:http://acm.hdu.edu.cn/showproblem.php? pid=2121 题意:n个顶点,m条边,求从某一点起建立有向图最小生成树而且花费最小.输出最小花费和根节点下标. ...

  8. Mongo性能测试-python脚本

    单线程 500+w条数据,插入时间:1小时,13分钟. 脚本: [root@10 hurl]# cat insert-mongo2.py #!/usr/bin/env python #coding=u ...

  9. 将分布式-队列的实现交给redis

    import requestsimport reimport timefrom redis import Redisimport threading REDIS_HOST, REDIS_PORT, P ...

  10. GoLang笔记-数组和切片,本质是就是长度不可变的可变的区别

    数组 Arrays 数组是内置(build-in)类型,是一组同类型数据的集合,它是值类型,通过从0开始的下标索引访问元素值.在初始化后长度是固定的,无法修改其长度.当作为方法的入参传入时将复制一份数 ...