Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 4: how can I understand how it all works?

I am using Laravel 3 in one project and it's been a joy. I have also looked at the source code several times to see how some things work behind the scenes.

But now in Laravel 4, I don't know where to begin or how to understand it all. Where can I learn all the behind the scenes of Laravel 4?

Case in point: I wanted to find out if the DB::insert() returns the id of inserted row. So I started searching. 1. I found the Illuminate\Support\Facades\Facade class that "encapsulates" DB. 2. The resolveFacadeInstance function is called and then I tried to print these arrays, but my computer hangs :-/. And I'm sure this would lead to many more classes that I wouldn't understand.

Is there a way I could try to learn the inner workings of Laravel 4? Maybe stack traces?

like image 617
duality_ Avatar asked Jan 15 '13 22:01

duality_


2 Answers

The facade class is just a filter class to allow you to call methods as if they were static. For the facade mappings go here: http://laravel.com/docs/facades#facade-class-reference

The starting point to fully understand laravel's inner-workings should begin at:

/public/index.php

You can follow the logic of the program, noticing that requires start.php, which loads an instance of the "Application" which is found here:

/vendor/laravel/framework/src/Illuminate/Foundation/Application.php
like image 116
girlcode Avatar answered Oct 25 '22 02:10

girlcode


This Tuts+ video shows a couple of ways of finding out what class is actually doing the work.

E.g.:

$root = get_class(DB::getFacadeRoot());
var_dump($root);
like image 24
David Oliver Avatar answered Oct 25 '22 03:10

David Oliver