> Symfony 6 >

Course Overview

Desarrollo Armonioso con Symfony 6

  • 9024 students
  • EN/ES Captions
  • EN/ES Script
  • Certificate of Completion

Your Guides

About this course

What PHP libraries does this tutorial use?

// composer.json
    "require": {
        "php": ">=8.1",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "symfony/asset": "6.0.*", // v6.0.3
        "symfony/console": "6.0.*", // v6.0.3
        "symfony/dotenv": "6.0.*", // v6.0.3
        "symfony/flex": "^2", // v2.4.5
        "symfony/framework-bundle": "6.0.*", // v6.0.4
        "symfony/monolog-bundle": "^3.0", // v3.7.1
        "symfony/runtime": "6.4.3", // v6.4.3
        "symfony/twig-bundle": "6.0.*", // v6.0.3
        "symfony/ux-turbo": "^2.0", // v2.0.1
        "symfony/webpack-encore-bundle": "^1.13", // v1.13.2
        "symfony/yaml": "6.0.*", // v6.0.3
        "twig/extra-bundle": "^2.12|^3.0", // v3.3.8
        "twig/twig": "^2.12|^3.0" // v3.3.8
    "require-dev": {
        "symfony/debug-bundle": "6.0.*", // v6.0.3
        "symfony/stopwatch": "6.0.*", // v6.0.3
        "symfony/web-profiler-bundle": "6.0.*" // v6.0.3

Woh, ¡es la hora de Symfony 6! La mejor versión de Symfony, la más fluida y la más agradable hasta la fecha, ya sea que estés construyendo una API o un frontend con JavaScript. Ah, y también es la primera versión de Symfony hecha completamente para PHP 8.

Symfony 6 trata de agilizar tu experiencia de desarrollo, poniendo soluciones a tu alcance y ayudándote a disfrutar del proceso. Porque si se hace correctamente, programar es GENIAL.

En sus marcas, listos, ¡código!

  • Crea una nueva y elegante (¡pero diminuta!) aplicación Symfony que hará que tus amigos se sientan orgullosos
  • Instala y explora el binario symfony para obtener trucos de desarrollo
  • Prepara PhpStorm y los plugins para obtener la mejor experiencia
  • Aprende sobre Symfony Flex y el sistema de "recetas"
  • Instala paquetes y paquetes de terceros
  • Crea rutas y controladores (¡con atributos de PHP 8!)
  • La herramienta bin/consola
  • Twig y las plantillas
  • La barra de herramientas de depuración web: depuración insana al alcance de tu mano
  • Configuración de JavaScript y activos con Encore y Symfony UX
  • Crear un punto final de la API JSON y llamar mediante Ajax
  • Un vistazo a la parte más importante de Symfony: los servicios

¡Vamos amigos!

Next courses in the Symfony 6: The Fundamentals section of the Symfony 6 Track!


Sort By
Login or Register to join the conversation
Nizar avatar Nizar 2 years ago


could you put tutorials about elastic search and Symfony?
it is in high demand in the job market

6 | Reply |
Yangzhi avatar Yangzhi 2 years ago

can not wait anymore

4 | Reply |

no one can ;) stay tuned!

| Reply |
Salvadorrueda avatar Salvadorrueda 1 year ago

Awesome content. Thanks for sharing. Time to put it in practice.

2 | Reply |
Ruslan avatar Ruslan 2 years ago

Hi Ryan,
Could you make a course about testing? (Codeception).
Thank you.

2 | Reply |

Hey Ruslan!

Thank you for your interest in SymfonyCasts tutorials! We don't have any certain plans to cover Codeception in the nearest future unfortunately, but I add this topic to ours idea pool, thanks! Also, we're planning to brush up our tutorials about testing, i.e. PHPUnit, PhpSpec and Behat - most probably it will happen in 2022, but no any possible release date yet too. Meanwhile, in case you're interested in Testing tools, I'd recommend you to take a look at Testing track: https://symfonycasts.com/tr...


| Reply |

Thank you.
But if you will update "Testing tutorials", don't forget about Stimulus too, please.

1 | Reply |

Hey @Ruslan!

We’re definitely planning by on a big testing update - we need it!

About Stimulus - no update is needed there. Stimulus 3 is out, but other than a renamed package name and a few minor features, it is identical to v2. But if the tutorial is not making this fact obvious enough, please let me know!


1 | Reply |

I mean tests for App with Stimulus.

1 | Reply |

We will definitely be talking about that in those tutorials :)

1 | Reply |
Yangzhi avatar Yangzhi 3 months ago

hi,in symfony,can override other bundle template file on my bundle? i only find override bundle template file on symfony templates directory

1 | Reply |

Hey Yangzhi,

Yes, you can override templates in third-party bundles, please take a look at Symfony docs: https://symfony.com/doc/current/bundles/override.html#templates - you just need to create a correct path in a specific dir that will match the path of the template from the 3rd-party bundle you want to override.


| Reply |
Azahari-Z avatar Azahari-Z 2 months ago

Wow.. did I really just finish the whole course hahah.. awesome tutorial

| Reply |

Hey Azahari,

Well done! Thank you for your kind words about this course :) We're actively working on a new Symfony 7 intro course, it will be available shortly, stay tuned ;)


1 | Reply |

Hi all, I have a doubt that has been chasing me for weeks, but can the structure of a project created with sy6 still be structured in bundles even if the main guide advises against it? I would like to rewrite an application (not at all small in size) which is currently organized in bundles and trying to recreate it without bundles generates tremendous confusion in the folder structure, despite the namespace. Thank you

| Reply |

Yo pasquale_pellicani!

The simple answer: yes! The longer answer: yes, but based on some things, you may want to make some changes.

SO, on a high level, unlike older versions, Symfony almost never cares about your directory structure anymore. For example, a command is not a command because it lives in the src/Controller/ directory / App\Controller\ namespace. You can put a controller anywhere, because it's the autowiring + autoregistration that tells Symfony this is a command. So, from a namespacing perspective, if you have a bunch of different namespaces for different bundles inside of your src/ directory, instead of App\, Symfony won't care at all. Probably the biggest difference (I'm guessing) is that a modern app will use service auto-registration. So your bundles will all need to explicitly wire the services, while a newer app won't. So, if you were creating a Controller, it can live anywhere, but you would need to manually register it as a service and give it the tag (which, again I'm guessing, you have been doing all along on that app).

The complication happens if you want to start using service auto-registration (and you weren't previously using it) and you want to have the same directory structure as a modern Symfony app. Then you DO need to make changes. But these are both optional things.

Anyway, I talked a lot about this in this tutorial - https://symfonycasts.com/screencast/symfony4-upgrade - including the (rather big) steps to take if you DO want to fully upgrade your app and make it look like a modern app. But, again that's up to you :). One potentially important point is this: when we changed the directory structure & added service autowiring & autoregistration, we didn't actually remove any code or any functionality. If you previously had an app full of bundles... whne going from symfony 3 -> symfony 4, that all kept working exactly like before.

If you do decide to update, you can always ask questions here :).


1 | Reply |
Juan-S avatar Juan-S 5 months ago

Hello Guys, I've been developing on Symfoni for three months, and your tutorials have been a great help. However, now I am working on setting up user sessions and I am stuck on how to send a message to the user when the session is about to expire, and how to manage a maximum number of sessions per user. If there is any tutorial that you can recommend, I would appreciate it.

| Reply |

Hi @Juan-S!

Apologies for my uncharacteristically SUPER slow reply. Busy time of year!

I've been developing on Symfoni for three months, and your tutorials have been a great help

Fantastic! Welcome to the community :)

However, now I am working on setting up user sessions and I am stuck on how to send a message to the user when the session is about to expire, and how to manage a maximum number of sessions per user.

Hmm. Typically, a session will "stay alive" as long as the user is active - e.g. if they continue to refresh the page, the session will stay alive forever. But, my guess is that you are setting a session.gc_maxlifetime to some finite value? Is it critical that the user is logged out right at 30 minutes of inactivity (using 30 minutes as an example)? Or are you just trying to give them a warning to be nice?

and how to manage a maximum number of sessions per user

This is also interesting. First, you'll definitely want to store sessions in the database. Then, I might create a UserSession table to track the relationship - it would have a ManyToOne to User and... perhaps a sessionId string column. To be honest, I'm struggling a bit because PHP sessions can be a bit of a pain to work with manually in this way. Ideally, you'd store your sessions in the database via a Session entity (an uncommon thing, but I believe I've seen people do it). Then it would be easy to have a UserSession entity that links to User and Session.

Anyway, I'm rambling a bit and not being particularly helpful. If you've made some progress but have more questions or problems, let me know and I'll do my best to help. And hopefully faster than 19 days later ;).


| Reply |
JesusCH avatar JesusCH 9 months ago

Ha sido un tutorial básico, practico y muy explicado.

| Reply |

Hola @JesusCH

Nos da gusto saber que te ha sido util nuestro tutorial


1 | Reply |
Anthony-E avatar Anthony-E 9 months ago

Hi There, I know that when we have a WordPress website, there are a lot of updates to manage every week. How does that exactly work with Symfony ? Is the pace of updates slower like a little change of syntax once in while or some new features added here and there that don't really mess with the existing features ?

| Reply |

Hey Anthony,

Yeah, code evolves a lot during the time that leads to new features and updates, i.e. led to continuous maintenance of the project. Well, I'm not aware of WordPress policy too much, but I probably may shed some light on Symfony's development process.

Well, first of all, except Symfony you most probably will have other third-party dependencies, i.e. packages that evolve on their own... I suppose in WordPress it's the same thing, even if we will consider additional plugins that might be installed in your project and also do some updates. So, if we will set aside those 3rd-party libs and focus only on Symfony - here's what we have.

Symfony has a so-called backward compatibility (BC) promise - you can learn more about it here: https://symfony.com/doc/current/contributing/code/bc.html - mostly it means that BC breaks may happen only during the major Symfony upgrades, e.g. from Symfony 5 -> Symfony 6. If you just want to upgrade a minor version, e.g. from Symfony 5.2 -> 5.4 - there should not be any BC breaks and your project should work well after the upgrade without any required changes. Well, in practice, it may not be 100% true, but it mostly depends on how well you're writing your code, or if you're using experimental components or not. So, such minor version updates will bring you new features as also some security fixes, etc, but they should not break your code base in theory.

Now about the Symfony roadmap (schedule of releases) - you can see more here: https://symfony.com/releases . As you can see Symfony has LTS (Long-Term Support) Release which means you don't have to update your major version if you don't want (don't need new features they may give you) and still get those important bugs and security fixes. LTS versions live for 3 years of maintenance + 1 extra year of only security fixes. If you have a big and complex project and don't want to upgrade it too often because it's time-consuming for you or just because you don't need those new features - stick to the LTS version :) The new LTS version is created every 2 years as you can see from the schedule.

So, that's basically it, that's how Symfony works, and that's what its release schedule and promises. Mostly, it's a similar process to the Ubuntu release cycle if you're aware of it. But it's up to you to decide if that fits your needs or not and how much load it will put on you to maintain it.

I hope this helps! :)


1 | Reply |
Yukako avatar Yukako 10 months ago edited

Hi all, I am running symfony 6 and cannot see the Debug Toolbar anymore. Only when I get an Error or warning it appears...
Please heeeeelp ! I get mad :(


    toolbar: true
    intercept_redirects: false

    profiler: { only_exceptions: false }
| Reply |

Hello @Yukako,

Do you have twig installed? and normal template for testing?


| Reply |
Miracle avatar Miracle 10 months ago

Awesome content

| Reply |

Hey Miracle,

Thank you for your feedback! We're happy to hear you liked it :) See more Symfony 6 related courses in this track: https://symfonycasts.com/tracks/symfony


| Reply |
Anthony-E avatar Anthony-E 10 months ago

Hi, I wish there was a tutorial about deploying to platform.sh (apparently the recommended hosting service).

| Reply |

Hey @Anthony-E!

Sorry for the slow reply! It's something I'd like to do too - I'll add a vote for it on our internal tracker. If you'd like to see an example of a site deployed with platform.sh, you can see https://github.com/symfony/ux/tree/2.x/ux.symfony.com


| Reply |
montecarlocode avatar montecarlocode 1 year ago

Awesome course. I figured out symfony's power.

| Reply |

Woo! Keep up the good work 💪

| Reply |
Default user avatar Maciek 1 year ago

U type param string $slug = null, I think better way is to type like this ?string $slug = null, or string $slug = '', bacause '' == null but '' === null is not true.

| Reply |
Tom O. avatar Tom O. 2 years ago edited

I am dynamically generating forms in Symfony 6. From the controller, I am calling a Form Type class in the traditional method. Therein, I am dynamically building some form fields based on the elements of the $options passed to the FormType class.

    public function index(Request $request): Response
    // Entity is called Breed
    $data = new Breed();

    // I am passing these $options to the form
    $options = [
            'form_1'          => true,
            'form_2'          => false,
            'units'           => 'pounds'
            'form_3'          => false,

    $form = $this->createForm(BreedSurveyType::class, $data, $options);

In the BreedSurveyType form class, I am able to get my variables where I declare them in the configureOptions() method...

 public function configureOptions(OptionsResolver $resolver): void
            'data_class' => Breed::class,
            'form_1'          => false,
            'form_2'          => false,
            'units'              => null
            'form_3'          => false,

In the buildForm() method, I can access the $options, but I cannot if I embed a sub-form.

 public function buildForm(FormBuilderInterface $builder,array $options): void 
        // form_1          =   true
        // form_2          =   false
        // units           =  'pounds'
        // form_3          =   true

        if ($options['form_1'] === true) {

        if ($options['form_2'] === true) {

        if ($options['form_3'] === true) {

.... in the parent-form, when I dump the $options variable,

array:59 [▼
  // snippet from web debug toolbar
  "form_1" => true
  "form_2" => false
  "units"  => "pounds"
  "form_3" => true

.... in the sub-form, when I dump the $options variable, I get the results from the declarations I made in the configureOptions() method.

array:59 [▼
  // snippet from web debug toolbar
  "form_1" => false
  "form_2" => false
  "units"  => null
  "form_3" => false

Effectively, is there a method to pass $options to a subform or do I need to isolate my logic of the dynamically created form in my BreedSurveyType class?

Thank you in advance.

| Reply |

Hey Tom O. !

Ah, I think I understand. By "sub form", you are referring to the AnimalNameType and other Animal###Type classes, right? If you want to pass options into those, you need to do it manually via the 3rd argument to ->add() For example. Suppose that you need to pass the units option into a sub-form:

public function buildForm(FormBuilderInterface $builder, array $options): void
    if ($options['form_1'] === true) {
            ['units' => $options['units']]

    // ...

Of course, you'll need to make sure that AnimalNameType allows a units option in its configureOptions() method, but it sounds like you already have that.

Is that what you were referring to? If I completely missed the point, let me know :).


| Reply |

Delete comment?

Share this comment

astronaut with balloons in space

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