Creating a Simple Web Application

This chapter explains how to create a simple application in Symfony framework. As discussed earlier, you know how to create a new project in Symfony.

We can take an example of “student” details. Let’s start by creating a project named “student” using the following command.

symfony new student

After executing the command, an empty project is created.

Controller

Symfony is based on the Model-View-Controller (MVC) development pattern. MVC is a software approach that separates application logic from presentation. Controller plays an important role in the Symfony Framework. All the webpages in an application need to be handled by a controller.

DefaultController class is located at “src/AppBundle/Controller”. You can create your own Controller class there.

Move to the location “src/AppBundle/Controller” and create a new StudentController class.