Skip to main content

Symfony: i make the question, he does the answers.

If you want to make your web development simpler you only need to remember what the web is built on: http.

The people at Symfony are really focused on this throughout all their documentation, and I totally agree.

HTTP

All the web runs on HTTP, and HTTP is a stateless protocol where you issue an http request to a web server and you get an http response from the web server.

The http protocol already defines some useful rules for specifying the address of what you are requesting: it’s called URI and just to name the most important things allows to define a path and some additional query parameters.

And finally, you already have some useful methods to define what do you mean to do with your request: GET, POST, PUT and DELETE (plus some other ones, less used).

Once you learn this, web development will open up for you in a thousand different ways without even considering the framework you’re working on. For more info you can get to the source of it all at http://www.w3.org/Protocols/rfc2616/rfc2616.html.

Symfony HttpFoundation

That’s why the Symfony framework is based on the very simple concepts of expecting an http request and giving an http response; you will see this repeated in every introductory piece about Symfony.

The aptly named HttpFoundation Symfony component contains a Request and a Response class that make half the job already.

A few consequences follows:

  • you must have a controller that handles the request
  • you must define a router to link URLs to controllers
  • you could have a model layer to deal with data
  • you could have a template layer to deal with presentation

That’s it, you can start developing with Symfony and add other pieces along the way.