Create a Symfony Project

Learn how to create and run a Symfony framework web application.

In this lesson, we’ll check if our terminal is ready for our Symfony project and then create a Symfony project.

Check if the system is ready

Now, we’ll check if our Linux system is ready for a Symfony installation. We can run the following command to check:

symfony check:requirements

This command should return:

[OK]                                         
Your system is ready to run Symfony projects                                      

Install and set up Git

We also need to set up Git; otherwise, creating the Symfony project will cause errors. This is because Symfony tracks changes through Git.

Git is a distributed version control system for managing and tracking changes to software source code over time. It allows developers to save and keep track of different versions of their code, making it easier to manage and collaborate on software projects.

We can install Git by running the following command in the terminal below:

sudo apt install -y git-all

The sudo password is educativecourse.

Then, we need to configure Git user details. These commands set the user who will save and commit lines of code. We’ll fix the user email to educativestudent@educative.io and the username to educativestudent for now. We can change this later.

git config --global user.email "educativestudent@educative.io"
git config --global user.name "educativestudent"

Create a Symfony project

Now, we can create a Symfony project by running the command given below. This command will create a folder named my_project_directory and a Symfony web application via Composer.

symfony new my_project_directory --version="6.1.*" --webapp

The success message will look like so:

 [OK] Your project is now ready in /home/educative/my_project_directory_

Well done on creating a Symfony project!

Get hands-on with 1400+ tech skills courses.