Sajjuks Harry Porter Store

Thursday 9 January 2014

The Symfony Application Flow

When you let Symfony handle each request, life is much easier. Symfony follows the same simple pattern for every request:
Symfony2 request flow
Incoming requests are interpreted by the routing and passed to controller functions that return Response objects.
Each "page" of your site is defined in a routing configuration file that maps different URLs to different PHP functions. The job of each PHP function, called a controller, is to use information from the request - along with many other tools Symfony makes available - to create and return a Response object. In other words, the controller is where your code goes: it's where you interpret the request and create a response.t's that easy! To review:
  • Each request executes a front controller file;
  • The routing system determines which PHP function should be executed based on information from the request and routing configuration you've created;
  • The correct PHP function is executed, where your code creates and returns the appropriate Response object.

No comments:

Post a Comment