Flag of Ukraine
SymfonyCasts stands united with the people of Ukraine
This tutorial has a new version, check it out!

Creating a new Symfony 5 Project

Video not working?

It looks like your browser may not support the H264 codec. If you're using Linux, try a different browser or try installing the gstreamer0.10-ffmpeg gstreamer0.10-plugins-good packages.

Thanks! This saves us from needing to use Flash or encode videos in multiple formats. And that let's us get back to making more videos :). But as always, please feel free to message us.

Hey friends! And welcome to the world of Symfony 5... which just happens to be my favorite world! Ok, maybe Disney World is my favorite world... but programming in Symfony 5 is a close second.

Symfony 5 is lean and mean: it's lightning fast, starts tiny, but grows with you as your app gets bigger. And that's not marketing jargon! Your Symfony app will literally grow as you need more features. But more on that later.

Symfony 5 is also the product of years of work on developer experience. Basically, the people behind Symfony want you to love using it but without sacrificing quality. Yep, you get to write code that you're proud of, love the process, and build things quickly.

Symfony is also the fastest major PHP framework, which is no surprise: - its creator also created the PHP profiling system Blackfire. So... performance is always a focus.

Go Deeper!

Watch our Blackfire.io: Revealing Performance Secrets with Profiling course to learn about Blackfire.

Downloading the Symfony Installer

So... let's do this! Start off by going to http://symfony.com and clicking "Download". What we're about to download is not actually Symfony. It's an executable tool that will help make local development with Symfony... well.. awesome.

Because I'm on a Mac, I'll copy this command and then go open a terminal - I already have one waiting. It doesn't matter where on your filesystem you run this. Paste!

curl -sS https://get.symfony.com/cli/installer | bash

This downloads a single executable file and, for me, puts it into my home directory. To make it so that I can run this executable from anywhere on my system, I'll follow the command's advice and move the file somewhere else:

mv /Users/weaverryan/.symfony/bin/symfony /usr/local/bin/symfony

Ok, try it!


It's alive! Say hello to the Symfony CLI: a command-line tool that will help us with various things along our path to programming glory.

Starting a new Symfony App

Its first job will be to help us create a new Symfony 5 project. Run:

symfony new cauldron_overflow

Where cauldron_overflow will be the directory that the new app will live in. This also happens to be the name of the site we're building... but more on that later.

Behind the scenes, this command isn't doing anything special: it clones a Git repository called symfony/skeleton and then uses Composer to install that project's dependencies. We'll talk more about that repository and Composer a bit later.

When it's done, move into the new directory:

cd cauldron_overflow

And then open this directory in your favorite editor. I already have it open in my favorite: PhpStorm, which I did by going to File -> Open Directory and selecting the new project folder. Anyways, say hello to your brand new, shiny, full-of-potential new Symfony 5 project.

Our App is Small!

Before we start hacking away at things, let's create a new git repository and commit. But wait... run:

git status

On branch master, nothing to commit.

Surprise! The symfony new command already initialized a git repository for us and made the first commit. You can see it by running:

git log

Add initial set of files

Nice! Though, I personally would have liked a slightly more epic first commit message... but that's fine.

I'll hit "q" to exit this mode.

I mentioned earlier that Symfony starts small. To prove it, we can see a list of all the files that were committed by running:

git show --name-only

Yea... that's it! Our project - which is fully set up and ready to leverage Symfony - is less than 15 files... if you don't count things like .gitignore. Lean and mean.

Checking Requirements

Let's hook up a web server to our app and see it in action! First, make sure your computer has everything Symfony needs by running:

symfony check:req

For check requirements. We're good - but if you have any issues and need help fixing them, let us know in the comments.

Starting the PHP Web Server

To actually get the project running, look back in PhpStorm. We're going to talk more about each directory soon. But the first thing you need to know is that the public/ directory is the "document root". This means that you need to point your web server - like Apache or Nginx - at this directory. Symfony has docs on how to do that.

But! To keep life simple, instead of setting up a real server on our local machine, we can use PHP's built-in web server. At the root of your project, run:

php -S -t public/

As soon as we do that, we can spin back over to our browser and go to http://localhost:8000 to find... Welcome to Symfony 5! Ooh, fancy!

Next: as easy as it was to run that PHP web server, I'm going to show you an even better option for local development. Then we'll get to know the significance of the directories in our new app and make sure that we have a few plugins installed in PhpStorm... which... make working with Symfony an absolute pleasure.

Leave a comment!

Login or Register to join the conversation
Juanma C. Avatar
Juanma C. Avatar Juanma C. | posted 1 year ago

Hello. I am following the steps to install symfony and create my first project but when I do the symfony check:req command I get the following error:
Your system is not ready to run Symfony projects

Fix the following mandatory requirements

* var/cache/ directory must be writable
> Change the permissions of "var/cache/" directory so that the web
> server can write into it.

* var/log/ directory must be writable
> Change the permissions of "var/log/" directory so that the web
> server can write into it.
I have tried to change the permissions of the file but it keeps giving me the same error. I hope you can give me a solution, thanks.

1 Reply

Hey Juan,

Hm, yeah, sounds like permissions issue. What command did you run exactly to fix the permissions? Could you try "sudo chmod -R 777 var/cache/" and "sudo chmod -R 777 var/log/"? Does it help? If no - I wonder what OS do you run? Also, do you use Docker or other virtulatization tool for running this project? Probably there's a better path where you could put that project?


Juanma C. Avatar
Juanma C. Avatar Juanma C. | Victor | posted 1 year ago

Hello!! Thank you very much for the directions. I was able to fix it. After several formulas, changing permissions of different folders and investigating solutions, I changed my project directory and removed the synchronization that it had with Google Drive and it could work for me. I don't know if this had anything to do with the problem. Thank you very much!!

1 Reply

Hey Juanma,

I'm happy to hear to works for you now! Yeah, syncing with G Drive might cause problems, as it may lock files, but not 100% sure, anyway, it's redundant for projects, as your projects should live in Git repo on e.g. GitHub.


1 Reply
Juan S. Avatar
Juan S. Avatar Juan S. | posted 2 years ago


I can not install the Symfony 5 version.

This commando install the version 4.4.20:
curl -sS https://get.symfony.com/cli... | bash

Using bin/console status I read:
Version 4.4.20

Any help?

Thank you.

1 Reply

Hey Juan S.

How did you create your project? By default it should install the latest release of Symfony, which makes me wonder if you're using an old PHP version (By old I mean lower than 7.2)


1 Reply
Juan S. Avatar

Hello, and thank you for your reply.

Yes, at the beginning I thought it was a problem with the php version, because the PHP installed by default with Mac OS Movaje is PHP 7.1 but after install PHP 7.3.8 and try again the command:
curl -sS https://get.symfony.com/cli... | bash
it continues installing Symfony 4.4.20.

Follow you can read the commands that I have executed:

This is the output of php-v:
---- Begin ----
iMac-de-Juan:~ sebastian$ php -v
PHP 7.3.8 (cli) (built: Aug 11 2019 20:50:16) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.8, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.8, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans
---- End ----

This is the output of curl -sS https://get.symfony.com/cli... | bash

---- Begin ----
iMac-de-Juan:~ sebastian$ curl -sS https://get.symfony.com/cli... | bash
Symfony CLI installer

Environment check
[*] cURL is installed
[*] Gzip is installed
[*] Git is installed
[*] Your architecture (amd64) is supported

Finding the latest version (platform: "darwin_amd64")...
Downloading version 4.23.2 (https://github.com/symfony/......
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 631 100 631 0 0 453 0 0:00:01 0:00:01 --:--:-- 1638
100 8474k 100 8474k 0 0 4321k 0 0:00:01 0:00:01 --:--:-- 4321k
Uncompress binary...
Making the binary executable...
Installing the binary into your home directory...
The binary was saved to: /Users/sebastian/.symfony/bin/symfony

The Symfony CLI v4.23.2 was installed successfully!

Use it as a local file:

Or add the following line to your shell configuration file:
export PATH="$HOME/.symfony/bin:$PATH"

Or install it globally on your system:
mv /Users/sebastian/.symfony/bin/symfony /usr/local/bin/symfony

Then start a new shell and run 'symfony'
---- End ----

Gracias Diego ;-)


Ahh but you're talking about the Symfony CLI version, not the Symfony framework version. What happens when you run symfony new folder_name?

De nada Juan! Nos conocemos? :)

Juan S. Avatar

Hello Diego

This is the output of the command:

--- Beging output ---
iMac-de-Juan:GitHub sebastian$ symfony new diegotest
* Creating a new Symfony project with Composer
(running /usr/local/bin/composer create-project symfony/skeleton /Users/sebastian/Documents/GitHub/diegotest --no-interaction)

* Setting up the project under Git version control
(running git init /Users/sebastian/Documents/GitHub/diegotest)

[OK] Your project is now ready in /Users/sebastian/Documents/GitHub/diegotest
--- End output ---

After that I execute this command:
symfony console about

--- Begin output ---
-------------------- ----------------------------------
-------------------- ----------------------------------
Version 4.4.20
Long-Term Support Yes
End of maintenance 11/2022
End of life 11/2023
-------------------- ----------------------------------
-------------------- ----------------------------------
Type App\Kernel
Environment dev
Debug true
Charset UTF-8
Cache directory ./var/cache/dev (212 KiB)
Log directory ./var/log (0 B)
-------------------- ----------------------------------
-------------------- ----------------------------------
Version 7.1.33
Architecture 64 bits
Intl locale n/a
Timezone UTC (2021-03-11T09:52:03+00:00)
OPcache false
APCu false
Xdebug false
-------------------- ----------------------------------
Environment (.env)
-------------------- ----------------------------------
APP_SECRET 21943794ba47162d8e650223720a6603
-------------------- ----------------------------------


I have noticed in this output that It said PHP version 7.1.33. But If I execute php -v in the same directory:
PHP 7.3.8 (cli) (built: Aug 11 2019 20:50:16) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.8, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.8, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans
--- END OUTPUT ---

I think maybe I have a problem with the PHP configuration.

I am running Mac OSX Mojave, I can not upgrade to a newer version of OSX because a compatibility issue with a very expensive sound card.

Gracias Diego, creo que no nos conocemos.. yo estoy escribiendo desde Madrid


Hey Juan!

Hmm, that's odd. In theory, Symfony CLI should use the same PHP version as your PHP CLI version. Let's try a couple of things. First run local:php:refresh and then symfony local:php:list at the root of your project, this will show a list with all the PHP versions available on your system.
After that, create a .php-version file and write in there "7.2.15" or any other available version on your system, and then, try to create a new project again.
If nothing works, you can install Symfony manually, you only have to clone the "Skeleton" or "Web-skeleton" repository (https://github.com/symfony/skeleton), and run composer install. Let me know if that worked

Entonces creo que no nos conocemos, yo estoy en México :)

Juan S. Avatar

Thank you Diego! Now it works.

After creating the .php-version text file with the PHP version (without quotes) it works.

I had a misunderstanding with Symfony versions. I thought that both CLI version and the Symfony project should have the same version, but now I have noticed that the last version of the Symfony CLI is 4.23.2. And the latest version of the Symfony Framework is 5.2.5.

Can you confirm me this?

I hope this helps other symfony developers.

¡Un fuerte abrazo!


Hey Juan, I'm glad to know that it's working for you now, and yes, Symfony CLI and Symfony framework are two different softwares. Sorry about the double quotes confusion :p


Leon Avatar

I think that's the CLI version number. What does your localhost:8000 screen say?


Hey Mike,

Thanks for this tip! Yeah, keep the Symfony CLI version up to date is always a good idea. For this, just run "symfony self:update" to pull new changes.


Default user avatar
Default user avatar Stephen Spittal | posted 3 years ago

Hello i have tried to follow along with this however i get an error at the point of moving smfony mv: rename /Users/stephenspittal/.symfony/bin/symfony to /usr/local/bin/symfony: No such file or directory

1 Reply

Hey Stephen Spittal

It's likely that you download the file in a different folder. What happens when you run curl -sS https://get.symfony.com/cli/installer | bash?

Default user avatar
Default user avatar Stephen Spittal | MolloKhan | posted 3 years ago

It downloads and installs as far as I can tell and tells me to move to use it globally


Interesting... can you double-check that the directories /Users/stephenspittal/.symfony and /usr/local/bin/ exists in your computer?
It's possible that you need to re-open your terminal after moving the binary


Default user avatar
Default user avatar Stephen Spittal | MolloKhan | posted 3 years ago

Diego it tells me I don't have permissions

Nicky S. Avatar

File and folder move command issues on Linux (File permissions Step 2)

sudo chmod -R a+rwx /path/to/folder


Bear in mind I am not a Linux security expert so I don't know if the site is going OTT with folder permissions. But I had move permission denied errors and the above worked and stopped the error.

I assume this is fixed now but for all future viewers.


Hey Nicky S.!

You "shouldn't" (I'm using quotes because... in programming, there are always surprises 😉) need to change any permissions to get things working on this step. But if this comes up again and you're having file permissions issues (and care enough to debug), let us know what's going on and we'll see if we can help :).



ahh it makes sense now! Try running it with sudo

Default user avatar
Default user avatar Stephen Spittal | MolloKhan | posted 3 years ago

Sudo symfony?


Oh sorry, I meant the last step, moving the binary file to /usr/local/bin/. If you already downloaded the binary but the bash script failed due to permissions, then you just have to make sure that /Users/stephenspittal/.symfony/bin/symfony exists and the move it to its destination manually

Bob19 Avatar

Just sharing my install notes, to keep in line with this tutorial:
-Composer version 2.5.4

  • PHP 7.4.3
  • OS: Archlinux 6.1.14-1-lts
    install project: php74 /usr/bin/composer create-project symfony/skeleton:"5.0.*" cauldron_overflow

Hey Bob19,

Yeah, ideally you need to run the Composer via the specific version of PHP like you did, it should prevent some possible errors.


Jimmy Avatar
Jimmy Avatar Jimmy | posted 5 months ago | edited

Hey there,

just started this project again and now i can't start the php server on localhost. Instead i can open it from Is that a problem?


Ok, just solved it :-)


Hey Jimmy,

Well, that should not be a problem, but it's odd that you cannot use localhost. Perhaps you need to edit your hosts file so that localhost points to

Default user avatar


I'm can't create an new project due this error: unable to run composer.phar create-project symfony/skeleton C:\Users\shaym\crud_system --no-interaction
can you help me?


Hey @Shayma,

can you run php or composer commands directly from your shell?


Shayma N. Avatar

Hi Vladimir,

Thanks for your respond, Yes I can run composer, but php not apparently, it it sticks, and I don't have any error


That is correct PHP behavior, to test it you should run php -v

Try to run symfony new crud_system -vvv to look where and why your project creation stucks


Shayma N. Avatar


I did that, but I stil have the same error unable to run composer.phar create-project symfony/skeleton C:\Users\shaym\crud_system --no-interaction

I realy need to fix it before next week :(

Shayma N. Avatar

B.T.W, the project is created but not compleet

Shayma N. Avatar

The index is missing!

[Web Server ] Dec 16 09:39:10 |WARN | HTTP unable to detect the front controller, disabling the PHP server error="Passthru script \"/index.php\" does not exist under C:\\Users\\shaym\\crud_system\\: CreateFile C:\\Users\\shaym\\crud_system\\index.php: The system cannot find the file specified."

Shayma N. Avatar

Now I have tried to create the project from the composer: $ composer create-project symfony/website-skeleton crud_system
And that workd. But is this normal? should I do somthing to fix it?


woh that is weird, ok lets try another way. Remove`
folder completely and try

composer create-project symfony/skeleton:"^5.0" crud_system```

I selected version 5.0 to be in sync with current course, but you may select any version you want depending on your needs

Shayma N. Avatar

Yeah that works! Thank you so much

But I stil not get it why command symfomy new not working...


That is tricky question, you are using native windows console, probably some paths are misconfigured, as I see it tries to execute phar file, probably that is the issue, but why symfony cli did it this way is mystery and needs a lot of investigation

BTW I'd recommend to use WSL for development on Windows PC it helps a lot =)


Shayma N. Avatar

Thank you so much!!

Default user avatar

I followed the symfony new cmd but I only get the vendor folder, nothing else. Is this the recipe thingy I've been reading about?

Mathis Avatar
Mathis Avatar Mathis | Matt | posted 8 months ago | edited

Hello Matt,

I had the same issue.
Try to run :

> symfony check:requirements

This command checks if your environnement is ready for Symfony and what are the missing extensions.
In my side I got this message :

 Your system is not ready to run Symfony projects

Fix the following mandatory requirements

 * simplexml_import_dom() must be available
   > Install and enable the SimpleXML extension.

So I install SimpleXML extension with : sudo apt-get install php-xml
After this installation, the creation of project work


Hey Matt,

Could you explain a bit more? Are you talking about "symfony" CLI tool you downloaded locally? What command exactly did you run? We do recommend you to follow the course by downloading a course code on a course chapter page (see "Download" button in the top right corner of the page) and start from the start/ directory. That directory has README.md file with instructions you need to follow to bootstrap the project locally.


Matt Avatar

I had a similar issue, after running "symfony new cauldron_overflow" in my terminal it creates that folder - cauldron_overflow, but all there is inside is:
-vendor folder


Hey Matt!

Hmm, that is super weird! What is inside the vendor/ directory? Is there a bunch of stuff (like vendor/symfony should have quite a few directories) or is it mostly empty? What about the symfony.lock file? It DOES look like, for some reason, the recipes didn't execute. But I want to prove that first. If you just try the command again, does it work? Or do you get this result every time?


Caleb S. Avatar
Caleb S. Avatar Caleb S. | posted 1 year ago

Does anyone know if the default git configuration done when the scripts initialize the repository works with GitHub's SSH and GPG keys, I am having trouble doing the initial push to my account.


Hey Caleb S.

Good question! You made me dig for a bit because I was not sure. I found this https://stackoverflow.com/a...
basically, you have to use Github's API V3

I hope it helps, cheers!

Caleb S. Avatar

Well it turns out I had to create the remote repository on GitHub before I could do this, although I could swear I have done this from the command line in the past. Maybe I am just thinking of branches though.

Marco P. Avatar
Marco P. Avatar Marco P. | posted 1 year ago

Hello, I have a problem installing symfony cli. Unfortunately I cannot update my Mac as it does not support versions higher than El Capitan. When I try to install symfony cli I get this error: dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
Referenced from: / usr / local / bin / symfony (which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib

I believe an older version of symfony cli may work, how do i install it? Thanks so much

Marco P. Avatar

Hi, I solved! I downloaded the cli-4.23.3 version, renamed the symfony_darwin_amd64 file to symfony, made it executable and copied it to /usr/local/bin. This version works with El Capitan. I hope it will be useful to others. bye

1 Reply
Cat in space

"Houston: no signs of life"
Start the conversation!

This tutorial also works great for Symfony 6!

What PHP libraries does this tutorial use?

// composer.json
    "require": {
        "php": "^7.3.0 || ^8.0.0",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "easycorp/easy-log-handler": "^1.0.7", // v1.0.9
        "sensio/framework-extra-bundle": "^6.0", // v6.2.1
        "symfony/asset": "5.0.*", // v5.0.11
        "symfony/console": "5.0.*", // v5.0.11
        "symfony/debug-bundle": "5.0.*", // v5.0.11
        "symfony/dotenv": "5.0.*", // v5.0.11
        "symfony/flex": "^1.3.1", // v1.17.5
        "symfony/framework-bundle": "5.0.*", // v5.0.11
        "symfony/monolog-bundle": "^3.0", // v3.5.0
        "symfony/profiler-pack": "*", // v1.0.5
        "symfony/routing": "5.1.*", // v5.1.11
        "symfony/twig-pack": "^1.0", // v1.0.1
        "symfony/var-dumper": "5.0.*", // v5.0.11
        "symfony/webpack-encore-bundle": "^1.7", // v1.8.0
        "symfony/yaml": "5.0.*" // v5.0.11
    "require-dev": {
        "symfony/profiler-pack": "^1.0" // v1.0.5