what happens in laravel 4 bootstraping

16
Laravel 4 What happens in bootstraping Jace Ju @ KKBOX

Upload: jace-ju

Post on 10-Jul-2015

462 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: What happens in laravel 4 bootstraping

Laravel 4What happens in bootstraping

Jace Ju @ KKBOX

Page 2: What happens in laravel 4 bootstraping

����

1. ����� (request)

2. �������"� ���3. ���!����� providers

4. ��������� ���5. � filters � routers

6. �����

Page 3: What happens in laravel 4 bootstraping

�������

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

• ���• � bootstrap/start.php �������• ������

Page 4: What happens in laravel 4 bootstraping

������

Application: IoC Container// � provider ���� session ��$app->bindShared('session', function($app){ return new SessionManager($app);});

// ������� session ��$session = $app['session'];

http://laravel.tw/docs/ioc</sub><sub>http://www.jaceju.net/blog/archives/php-di-container/

Page 5: What happens in laravel 4 bootstraping

�������� hostname ������

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

testing ��� ����������������

Page 6: What happens in laravel 4 bootstraping

����������

$env = $app->detectEnvironment(function () { return 'production';});

http://blog.wu-boy.com/2014/08/laravel-application-environments-without-hostnames/

Page 7: What happens in laravel 4 bootstraping

������

• �� bootstrap/paths.php

• �� Laravel Framework ��� start.php

Page 8: What happens in laravel 4 bootstraping

Framework �������• �� Facades �"�,)���

• '�+�&*��� app/config ���"���

• (� production ����+�&*����� #• ���� Exception

• "��%� timezone

• �)���.-� ��$!http://laravel.tw/docs/facades

Page 9: What happens in laravel 4 bootstraping

����� providers• �� app/config/app.php � providers ��

• � � app/storage/meta/services.json����� (�)

• � ������ #�����• ������"!������ IoC container �

Page 10: What happens in laravel 4 bootstraping

Provider �������• �� (Eager loading)

• ������ (Event loading)

• �� console mode � ��� (Deferred loading)

Page 11: What happens in laravel 4 bootstraping

���������

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

• � app/filters.php

Page 12: What happens in laravel 4 bootstraping

���������

�� app/start/{env}.php ����• app/start/local.php

• app/start/production.php

Page 13: What happens in laravel 4 bootstraping

�� routers�� app/routes.php• ��� (route)

• ������������• � request �� Controller

• � filter ��������

Page 14: What happens in laravel 4 bootstraping

������

• Request �������� IoC �• � request ����� � Response ��• � Response ���������

Page 15: What happens in laravel 4 bootstraping

��

• Laravel � IoC Container ���• � �����• Router / Request / Response ���

Page 16: What happens in laravel 4 bootstraping

�����