Home >Backend Development >PHP Tutorial >Questions about lumen source code

Questions about lumen source code

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-10-11 14:23:151146browse

In the Application.php constructor of lumen, how to start the container

Questions about lumen source code

<code>vendor/laravel/lumen-framework/src/Application.php line:103 
</code>

Questions about lumen source code

<code>vendor/illuminate/container/Container.php line:1159
</code>

I don’t understand its function and purpose.

Reply content:

In the Application.php constructor of lumen, how to start the container

Questions about lumen source code

<code>vendor/laravel/lumen-framework/src/Application.php line:103 
</code>

Questions about lumen source code

<code>vendor/illuminate/container/Container.php line:1159
</code>

I don’t understand its function and purpose.

Looked at the source code of Lumen 5.3:

<code class="php">protected function bootstrapContainer()
{
    static::setInstance($this);

    $this->instance('app', $this);
    $this->instance('Laravel\Lumen\Application', $this);

    $this->instance('path', $this->path());

    $this->registerContainerAliases();
}</code>

Combined with $this->instance(...), it is to implement the singleton mode.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn