Jump to content

Understanding what a framework is doing behind the scenes.


Recommended Posts

My aim is to really understand what a framework does behind the scenes. Don't worry I am not trying to write my own, but I really want to understand a framework..


I tried going through the source of a few, and even though I understood what the individual lines were supposed to do, I couldn't quite get the 'logic' of the app. Any suggestions on how to 'read' code ? 


Any other resources that may help me in knowing how/what  framework does?





Link to comment
Share on other sites

It can be hard to grasp a high-level concept from looking at just the code sometimes, it's generally best to look into the documentation for the framework for any explanations first. You can combine that then with going through the relevant code to get a better picture of not only what is being done but how it's being done.


Each framework is going to do things differently, so you should pick a single framework and work on learning that fairly well. Symfony has some pretty good documentation about it's internal workings that would make a good starting point.


A benefit also is to setup something like XDebug so that you can step through code as a request is processed to better follow it's path and see what is going on.

Link to comment
Share on other sites

Laravel is much simpler than Symfony, and while there docs generally suck, they do have a few paragraphs on the Request Lifecycle.


A great option when doing this sort of thing is to get yourself a decent PHP debugger and simply step through the process.


eg; to do so in Symfony, start by adding a breakpoint to https://github.com/symfony/symfony-standard/blob/master/web/app_dev.php#L28 and hitting the default route. Then step through a few times to see what happens.

Link to comment
Share on other sites

  • 4 weeks later...

If the framework that you want to understand is built on php5.2 such as CackePHP 1 Zend 1, i recommend using xdebug to step through code.

i tried this way for framework base on php5.3 such as symfony2 but difficult.

xdebug works fine with >= php5.3, Im not sure what your issue is.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.