what happens in laravel 4 bootstraping
TRANSCRIPT
Laravel 4What happens in bootstraping
Jace Ju @ KKBOX
����
1. ����� (request)
2. �������"� ���3. ���!����� providers
4. ��������� ���5. � filters � routers
6. �����
�������
• � public/.htaccss �� (Apache)• public/index.php �
• ���• � bootstrap/start.php �������• ������
������
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/
�������� hostname ������
$env = $app->detectEnvironment([ 'local' => ['jace-note-book'], 'production' => ['web-machine-1', 'web-machine-2'],]);
testing ��� ����������������
����������
$env = $app->detectEnvironment(function () { return 'production';});
http://blog.wu-boy.com/2014/08/laravel-application-environments-without-hostnames/
������
• �� bootstrap/paths.php
• �� Laravel Framework ��� start.php
Framework �������• �� Facades �"�,)���
• '�+�&*��� app/config ���"���
• (� production ����+�&*����� #• ���� Exception
• "��%� timezone
• �)���.-� ��$!http://laravel.tw/docs/facades
����� providers• �� app/config/app.php � providers ��
• � � app/storage/meta/services.json����� (�)
• � ������ #�����• ������"!������ IoC container �
Provider �������• �� (Eager loading)
• ������ (Event loading)
• �� console mode � ��� (Deferred loading)
���������
�� app/start/global.php• ������ ������!• �� Log �����• �� Exception ����• ���� ���������
• � app/filters.php
���������
�� app/start/{env}.php ����• app/start/local.php
• app/start/production.php
�� routers�� app/routes.php• ��� (route)
• ������������• � request �� Controller
• � filter ��������
������
• Request �������� IoC �• � request ����� � Response ��• � Response ���������
��
• Laravel � IoC Container ���• � �����• Router / Request / Response ���
�����