LoginSignup
5
3

More than 5 years have passed since last update.

Laravel HTTPリクエスト受付からレスポンスまでの概略

Last updated at Posted at 2017-01-24

LaravelのHTTPリクエスト受付からレスポンスまでの処理概略メモ

参照したバージョン

5.3

メモ

public/index.php
    // Register The Auto Loader
    require bootstrap/autoload.php
        require vendor/autoload.php
        require bootstrap/cache/compiled.php

    // Turn On The Lights
    $app = require bootstrap/app.php
        // $appの生成
        $app = new Illuminate\Foundation\Application

        Http/Console Kernelのコンテナへの登録
            (Http Kernelの実体はapp/Http/Kernel.phpと親のIlluminate\Foundation\Http\Kernel)

    // Run The Application
    $kernel = $app->make(...)

    $response = $kernel->handle (= Illuminate\Foundation\Http\Kernelのhandleを呼び出し)
        $this->bootstrap();
            $this->app->bootstrapWith($this->bootstrappers());
                各要素をbootstrap
                protected $bootstrappers = [
                'Illuminate\Foundation\Bootstrap\DetectEnvironment', ->.envのload
                'Illuminate\Foundation\Bootstrap\LoadConfiguration', ->bootstrap/cache/config.phpまたは、config/*.phpの参照
                'Illuminate\Foundation\Bootstrap\ConfigureLogging',
                'Illuminate\Foundation\Bootstrap\HandleExceptions',
                'Illuminate\Foundation\Bootstrap\RegisterFacades',   ->config/app 'app.aliases'の参照
                'Illuminate\Foundation\Bootstrap\RegisterProviders', ->config/app 'app.providers'の参照
                'Illuminate\Foundation\Bootstrap\BootProviders',     ->Illuminate\Foundation\Applicationのboot
                ];
        Pipelineクラスにより、middleware/routerを経由してrequestを送信し、responseを得る
            (routerからのdispatchでコントローラのアクションの実施など、ビジネスロジック実施)

    $response->send (= Symfony\Component\HttpFoundationのsendメソッドを呼び出し)
        header関数やechoによる応答返却実施

    $kernel->terminate (= Illuminate\Foundation\Http\Kernelのterminateを呼び出し)
        各middlewareのterminateを呼び出し 

5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3