Run the Symfony Application

Learn how a home page is created and how to run the Symfony application.

Now that we have installed all the required software and created a Symfony project, we are ready to run our Symfony application and check if the home page is working correctly.

Inspect Symfony files

In the widget below, the Symfony application we created previously can be seen.

Under the src/Controller folder, we will see the HomePageController.php file.

This is an initial home page created for us.

It routes to the root of the application.

It just returns sample text for now.

Run Symfony

Click the “Run” button.

Once the application is up and running, click the URL below the “Run” button to open the application in a new tab.

You’ll see a home page with some content that will include the following:

Hello HomePageController!

This controller loads the templates/home_page/index.html.twig file.

Modify the home page

Let’s practice modifying the web pages.

Open the templates/home_page/index.html.twig page.

    <h1>Hello {{ controller_name }}!</h1>

Under the line given above, add the lines given below. Add your name if you wish.

    <h1>Hello, I am learning a lot at educative</h1>
    <p> Hello my name is .... <p>

Click the “Run” button to see the changes in the Symfony application.

Get hands-on with 1200+ tech skills courses.