Chapters
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Welcome to the first Symfony 7 tutorial! My name is Ryan - I live here in the fantasy world of Symfonycasts and... I am beyond excited to be your guide through this series all about Symfony, web development... bad jokes... space animations, and most importantly, building real things we can be proud of. For me, it feels like I'm the lucky person that gets to give you a personal tour of the Enterprise... or whatever nerdy thing gets you most excited.
And that's because, I love this stuff. Bootstrapping databases, building beautiful user interfaces, writing high-quality code... it gets me out of bed in the morning. And Symfony is the best tool to do all of this... and become a better developer along the way.
And that's really my goal: I want you to enjoy all of this as much as I do ... and to feel empowered to build all the amazing things you have floating around in your mind.
What Makes Symfony Special
Now, one of my favorite things about teaching Symfony is that our project is going to start tiny. That makes it easy to learn. But then, it'll scale up automatically as we need more tools via a unique recipe system. Symfony is actually a collection of over 200 small PHP libraries. So that's a ton of tools... but we get to choose what we need.
Because, you might be building a pure API... or a full web app, which is what we'll focus on in this tutorial. Though, if you are building an API, follow the first few tutorials in this series, then pop over to our API Platform tutorials. API Platform is a mind-blowingly fun & powerful system for making APIs, built right on top of Symfony.
Symfony is also blazingly fast, has long-term support versions and works a lot on creating a delightful developer experience while keeping to programming best-practices. This means we get to write high-quality code and still get our work done quickly.
Ok, enough of me gushing about Symfony. Ready to get to work? Then beam aboard.
Installing the Symfony Binary
And head over to https://symfony.com/download. This page has instructions on how to download a standalone binary called symfony
. Now this is not Symfony itself... it's just a little tool that'll help us do things, like start new Symfony projects, run a local web server or even deploy our app to production.
Once you've downloaded and installed it, open a terminal and move into any directory. Check that the symfony
binary is ready to go by running:
symfony --help
It's got a bunch of commands, but we'll just need a few. Before we start a project, also run
symfony check:req
which stands for check requirements. This makes sure that we have everything on our system needed to run Symfony, like PHP at the correct version and some PHP extensions.
Once this is happy, we can start a new project! Do it with symfony new
and then a directory name. I'll call mine starshop
. More on that later.
symfony new starshop
This will give us a tiny project with only the base things installed. Then, we'll add more stuff little-by-little along the way. It's gonna be great! But later, when you feel comfortable with Symfony, if you want to get started more quickly, you can run the same command, but with --webapp
to get a project with much more stuff pre-installed.
Anyway, move into the directory - cd starshop
- then I'll type ls
to check things out. Cool! We'll get to know these files in the next chapter, but this is our project... and it's already working!
Starting the symfony Web Server
To see it working in a browser, we need to start a web server. You can use any web server you want - Apache, Nginx, Caddy, whatever. But for local development, I highly recommend using the symfony
binary we just installed. Run:
symfony serve
The first time you do this, it might ask you to run another command to set up an SSL certificate, which is nice because then the server supports https.
And... bam! We have a new web server for our project running at https://127.0.0.1:8000. Copy that, spin over to your most favorite browser, paste and... welcome to Symfony 7! That's what I was going to say!
Next, let's sit down, order some Earl Grey tea, and become friends with every file in our new app... which isn't very many.
14 Comments

Hey @ramontalban
Yes, you're right, Symfony CLI will choose what version to install based on your PHP version.
In the "Versions" tab below the video you can see all the libraries and requirements for this tutorial
Cheers!


Thank you and thanks to the SymfonyCasts Team!! I was waiting for it so much!! Do you have a date for the next lesson?

Hey @Leonard_Bira
I'm happy to hear you like our tutorials :)
We release one new chapter every week-day
Cheers!


Hello,
Fist of all, Thank you and thanks to the SC Team ! Your tutorials are insanely good and I learn a lot from you !
I'm sorry to bother but I need your help :
I'm upgrading to Symfony 7.2 and the CSRF Protection break my form when I submit them in a turbo-frame.
When I submit from the full page, everything works well but when I load this turbo-frame in another page or in a modal, I systematically have a 422 http response due to the CSRF Token.
If you know a good way to patch this I'd love to know !
Thank you a lot ;)
Hey @Thomas-P
Just mentioned it somewhere in comments and will repeat here, for now if you have issues on any work project it will be better to deactivate stateless CSRF. Ideally it should be done inside csrf.yaml
IIRC you should disable header_check
and comment stateless_token_ids
Cheers!
This doesn't work. the symfony new command for version 7 is currently broken, i have raised issue on github if you use --version=lts you get a working project.
Hey @red_smeg ,
Thanks for reporting it! I bet things will be fixed soon if there's an issue. Btw, we do recommend our users to download the course project code and start from the start/ directory instead of creating a new Symfony project. You can go with a completely new project, that's up to you, but keep in mind of some possible mismatches with the code you see in the video :)
Cheers!


Best tutorials ever, honestly I didn't see anything barely similar to such great quality of content and video/audio. Amazing job SymfonyCasts!
Btw, you're using iTerm2 for terminal? How did you managed to make command lines separation (gray --- symbols after each command execution)
Hey Kirill,
Thank you for your feedback! We're really happy to hear you like SymfonyCasts content :)
About the terminal - yes, that is iTerm2, but with some theme installed, and I believe that theme do that command separation out of the box, so no additional config. Unfortunately, I don't know what exactly theme Ryan uses. Probably googling themes for iTerm2 with some preview images will help.
Cheers!

Me too! :D
Nice to see you in this video. I had almost forgotten what you look like. This might not be the right place for requests, but could you make a short series titled "How to Contribute to Symfony"? I really want to contribute, but I don't know how to start.
Thank you for all of your fantastic tutorials!
Ha! Honestly, it's weird for ME to see me when I'm editing these videos 🤣.
but could you make a short series titled "How to Contribute to Symfony"
We have one... but it's pretty old at this point. It needs a facelift :) https://symfonycasts.com/screencast/contributing - a lot is still relevant, but I'm going to add it to our tutorial idea list.
A lot of how to contribute depends on what your interests are. If you're into the frontend world, for example, using Symfony UX & watching + reviewing over at https://github.com/symfony/ux is quite accessible, as this is still newer tech. The more you follow issues and PRs and use the tech, the more it will become, little-by-little, more obvious where you might fit in. And I'm always happy to answer questions (e.g on Symfony Slack).
Cheers!

"Houston: no signs of life"
Start the conversation!
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"php-cs-fixer/shim": "^3.46", // v3.46.0
"phpdocumentor/reflection-docblock": "^5.3", // 5.3.0
"phpstan/phpdoc-parser": "^1.25", // 1.25.0
"symfony/asset": "7.0.*", // v7.0.3
"symfony/asset-mapper": "7.0.*", // v7.0.2
"symfony/console": "7.0.*", // v7.0.2
"symfony/dotenv": "7.0.*", // v7.0.2
"symfony/flex": "^2", // v2.4.3
"symfony/framework-bundle": "7.0.*", // v7.0.2
"symfony/monolog-bundle": "^3.0", // v3.10.0
"symfony/property-access": "7.0.*", // v7.0.0
"symfony/property-info": "7.0.*", // v7.0.0
"symfony/runtime": "7.0.*", // v7.0.0
"symfony/serializer": "7.0.*", // v7.0.2
"symfony/stimulus-bundle": "^2.13", // v2.13.3
"symfony/twig-bundle": "7.0.*", // v7.0.0
"symfony/ux-turbo": "^2.13", // v2.13.2
"symfony/yaml": "7.0.*", // v7.0.0
"symfonycasts/tailwind-bundle": "^0.7.1", // v0.7.1
"twig/extra-bundle": "^2.12|^3.0", // v3.8.0
"twig/twig": "^2.12|^3.0" // v3.8.0
},
"require-dev": {
"symfony/debug-bundle": "7.0.*", // v7.0.0
"symfony/maker-bundle": "^1.52", // v1.53.0
"symfony/stopwatch": "7.0.*", // v7.0.0
"symfony/web-profiler-bundle": "7.0.*" // v7.0.2
}
}
Como apunte, añadir que es necesario al menos php 8.2 para Symfony 7, con versiones inferiores obtienes Symfony 6.4