From the course: Symfony 6 Essential Training

Unlock the full course today

Join today to access over 25,100 courses taught by industry experts.

Requests and responses

Requests and responses

- [Instructor] Most web development is about accepting a request and returning an appropriate response. In Symfony, this is handled by the HttpKernel component. Let's start by looking at the HttpKernel interface and specifically the handle method. Now, this is just the interface, so only the method definition. The important parts are that the handle method accepts a request object and returns a response object. Most commonly, you will be handling requests in a controller. I've added a hello controller. Looking at the world method, we see it as returning a new response object with some markup. I'm skipping the routing portion for now but when I visit the URL, you can see our markup. Jumping back to the response in hello controller, you can change the status. The default is 200 and I could have set it to 404. Now, when I reload, the debug toolbar shows a status of 404. Back in our controller, I have one more controller…

Contents