Getting started with Symfony 4: Introduction

December 2, 2018
learning symfony

Frameworks are a powerful tool for quickly building web applications. Learning how to use frameworks will help you to build your projects better and faster. One of the most popular PHP frameworks is called Symfony, which is known to be the hardest to learn from all others PHP frameworks.

Before we start to talk about all the features that Symfony offers, let’s start with the answer to the question, what is Symfony?

Symfony is a set of PHP Components, a Web Application framework, a Philosophy, and a Community — all working together in harmony.

Which means that you can use Symfony components on a project that is not Symfony-based. One of the examples is the Laravel framework, which is based on Symfony components  such as Finder, HttpKernel, Process, Routing, Console etc.

To start with your first Symfony 4 project, make sure you already have Composer installed on your system. To check if you already have it, open your terminal and type

if you get something like:

inside your terminal, then you have Composer installed and you are ready, if not, you will have to install Composer first. There are two ways to start Symfony 4 project. If you are building traditional web application, open your terminal and run

or if you are building a microservice, console applicaton or API

Once you run one of these two commands, composer will clone the symfony project and then runs composer install to download it’s dependencies. Once it’s finished, at the bottom of terminal, you will get clear instructions what to do next.

Move into the new directory:

You can run our app immediately by executing:

Now open your browser and look at

Symfony Demo

Congrats! You just started your first Symfony 4 project. Each time you start a new project, Symfony will provide you with a perfect .gitignore file. No need to worry about that. Just run:

and you are all set!

You Might Also Like


  • Reply Eva December 2, 2018 at 17:45

    Will you explain how does the symfony deal with auth?

    • Dejan Vujanović
      Reply dejanvujanovic December 2, 2018 at 17:18

      It is something I am going to cover in future. Cheers!

  • Reply Anthony December 2, 2018 at 18:09

    Cool, but how about routes, controllers, bundles …?

    • Dejan Vujanović
      Reply dejanvujanovic December 2, 2018 at 17:17

      I will write about Routes and Controllers during the next week. Cheers!

  • Reply Tony89 December 6, 2018 at 17:02

    Will you write about Doctrine?

    • Dejan Vujanović
      Reply dejanvujanovic December 6, 2018 at 21:25

      It will be one of the topics I am going to cover.

    Leave a Reply