$30 off During Our Annual Pro Sale. View Details »

What happens in Laravel 4 bootstraping

What happens in Laravel 4 bootstraping

介紹 Laravel 4 的啟動過程

大澤木小鐵

December 16, 2014
Tweet

More Decks by 大澤木小鐵

Other Decks in Programming

Transcript

  1. Laravel 4
    What happens in bootstraping
    Jace Ju @ KKBOX

    View Slide


  2. 1. (request)
    2. "
    3.
    ! providers
    4.

    5.
    filters routers
    6.

    View Slide


  3. • public/.htaccss (Apache)
    • public/index.php


    • bootstrap/start.php

    View Slide


  4. Application: IoC Container
    // provider
    session
    $app->bindShared('session', function($app)
    {
    return new SessionManager($app);
    });
    // session
    $session = $app['session'];
    http://laravel.tw/docs/ioc
    http://www.jaceju.net/blog/archives/php-di-container/

    View Slide


  5. hostname

    $env = $app->detectEnvironment([
    'local' => ['jace-note-book'],
    'production' => ['web-machine-1', 'web-machine-2'],
    ]);
    testing

    View Slide



  6. $env = $app->detectEnvironment(function () {
    return 'production';
    });
    http://blog.wu-boy.com/2014/08/laravel-application-environments-without-hostnames/

    View Slide


  7. • bootstrap/paths.php
    • Laravel Framework start.php

    View Slide

  8. Framework
    • Facades ",
    )
    • '+&* app/config "
    • ( production +&* #
    • Exception
    • "% timezone
    • ).- $!
    http://laravel.tw/docs/facades

    View Slide

  9. providers
    • app/config/app.php providers
    • app/storage/meta/services.json
    (
    )

    #

    • "! IoC container

    View Slide

  10. Provider

    (Eager loading)
    • (Event loading)
    • console mode (Deferred loading)

    View Slide



  11. app/start/global.php
    • !
    • Log
    • Exception


    • app/filters.php

    View Slide



  12. app/start/{env}.php
    • app/start/local.php
    • app/start/production.php

    View Slide

  13. routers
    app/routes.php

    (route)

    • request Controller
    • filter

    View Slide


  14. • Request IoC

    request Response
    • Response

    View Slide


  15. • Laravel IoC Container


    • Router / Request / Response

    View Slide


  16. View Slide