7min.

SymfonyCon at Disneyland Paris for the 15+2th birthday of Symfony

Cet article est aussi disponible en 🇫🇷 Français : SymfonyCon Disneyland Paris pour les 15+2 ans de Symfony !.

After more than two years of waiting, SymfonyCon 2020 2021 2022 was held at Disneyland Paris on November 17th and 18th. We were delighted to meet community members, other members of the Core Team, as well as contributors who have been involved in Symfony for years.

The venue, very large, was perfect to host this event, with 3 conference rooms: 1500, 600, and 300 seats. Symfony even managed to privatize the theme park (Walt Disney Studios Park) for the occasion, which allowed us to go through the attractions with about… 0 minute wait 😍

Let’s dive into the heart of the matter: the conferences.

Section intitulée our-favorite-talksOur favorite talks

Section intitulée opening-keynote-by-fabien-potencierOpening Keynote, by Fabien Potencier

Fabien announced the integration of Twig in Symfony during SymfonyLive Paris 2022. This topic has not progressed too much since the announcement. However, he worked on the integration of two new components in Symfony. Here are the descriptions we can read in the respective READMEs:

  • RemoteEvent : Symfony RemoteEvent eases handling remote events ;
  • Webhook : Symfony Webhook eases sending and consuming webhooks.

RemoteEvent, the first component allows the reception of events coming from an external source: a Webhook, an AMQP message, etc. It could be seen as an EventDispatcher, but the event emitter is external to the application.

This component aims to provide an abstraction to handle the most popular events, such as:

  • Mailer :
    • MailerDeliveryEvent : received, dropped, delivered, deferred, bounce ;
    • MailerEngagementEvent: open, click, spam, unsubscribe ;
  • SMS :
    • SmsEvent : failed, delivered.

This list will be expanded as needs arise. The ones that instinctively come to mind are payment events, subscription events, CI status events, etc.

Of course, each application can define and use its own events.

Webhook, the second component is very light. It allows sending and receiving webhooks. It will be released with different bridges (like Mailer or Notifier), to validate and parse payloads.

At JoliCode, we often deal with webhooks (Stripe, Mailgun, Slack), and we post a lot of webhooks to Slack. We’re looking forward to using these two new components.

Did you know we have some open-source projects related to webhooks and Slack?

Section intitulée final-keynote-by-ryan-weaverFinal Keynote, by Ryan Weaver

Ryan reviewed the evolution of PHP and Symfony over the past year. There are so many new features that we can’t list them all here. But here are some of the highlights:

  • Constant improvement of the DX ;
  • Constructor Property Promotion & Named arguments ;
  • Attributes, everywhere, now natively supported by Symfony;
    • #[Orm\Column()] : Doctrine can now automatically detect the column type from the type of a PHP class property;
    • #[Route()], #[IsGranted()], #[Cache()], etc : allows us to remove sensio/framework-extra-bundle ;
    • #[CurrentUser()] ;
    • #[Autowire('%kernel.debug%')], #[Autowire(service: 'twig.loader')] ;
    • #[AsEventListener(Request::class, 'doSomething')] ;
    • #[AsCommand], #[AsController], #[AsMessageHandler] ;
    • #[AsDecorator(decorates: 'router')] ;
  • A full Profiler redesign ;
  • More debug commands, Messenger queues analysis ;
  • New components:
  • And some important features :
  • Symfony UX is not experimental anymore 🎉

Fun detail: Ryan had stacked the disguises, and during his talk he took them off one after the other 😂

Section intitulée phpPHP

Nicolas Grekas presented a topic that kept him busy for the last 6 months! Symfony 6.2 will be able to generate ghost objects. Ghost objects are one of the various ways of doing performance optimization thanks to the lazy loading of dependencies.

The introduction about the different types of lazy loading was very interesting. Regarding the explications about the ghost objects, we preferred his blog post on the matter which was more exhaustive.

What will it change in our everyday’s life ? Not much, at least directly. This code is used by third-party libraries, like Doctrine. But we wanted to thank Nicolas for his hard work on this subject.

Ondřej Mirtes, PHPStan’s creator, presented us some advanced functionalities of PHPStan. The slides are very comprehensive and we strongly advise to read them (when they are available). If you don’t have time, here are some points that held our attention:

  • With PHPDoc you may tell more things than with PHP regular typing;
  • Advanced types : non-empty-array, positive-int, non-empty-string;
  • Specify keys and values in an array : array{a: int, b: string, c: bool};
  • Specify a bitmask : int-mask<1, 2, 4> or int-mask-of<Foo::BAR_*>;
  • Force a callback signature callable(int, int): string;
  • Define aliases and import them:
    /**
    * @phpstan-type UserAddress array{street: string, city: string, zip: string}
    * OR
    * @phpstan-import-type UserAddress from AnotherClass
    */
    class User
    {
       /**
        * @var UserAddress
        */
       private $address; // is of type array{street: string, city: string, zip: string}
    }
    
  • Use generics
    /**
     * @template T
     * @param T $p
     * @return T
     */
    function returnTheSameTypeTheFunctionAccepts($p)
    
  • Specify via stubs some classes located in the vendors.

Kévin Dunglas introduced us a new PHP application server: FrankenPHP.

What is an application server ? PHP is based upon a design of Fire & Forget or Share nothing. It means that when a HTTP request comes in:

  • PHP will boot your Symfony application (with all its services)
  • Handle the request
  • Throw everything away

What a time loss, isn’t it? In Java, for instance, the booting step is done only once, no matter the quantity of HTTP requests. This is why a Java application is slow to boot.

There already are various attempts at PHP application servers. We could name Swoole or RoadRunner for examples. However, all the existing solutions have a major issue: they are not really integrated into PHP.

Kevin decided to write a new SAPI (an entrypoint for PHP, ex: CLI, FPM, mod_apache, etc). This SAPI is embedded in a HTTP server. So now, when a new request comes in, the server uses an already warmed Symfony application: all services are already instantiated.

You probably have understood it, the point is to greatly improve the performances of your applications.

Integration with Symfony is very easy because it provides a new Symfony runtime. We tried it on a small project and it works really well.

The project is still in beta. It is not ready for production yet. Still, we are very happy to see that Kevin is still working on PHP. And we are excited to see it production ready & battle tested.

Section intitulée frontendFrontend

Florent Destremau presented an innovative topic in the Symfony community: Hotwire integration with Symfony.

Nowadays, to make a web application, it is possible, among other things, to develop an API and a frontend with our favorite JavaScript framework (React, Vue, Svelte, etc). But with Hotwire, no need for an API, the application returns HTML directly to the user. Hotwire will then add some JavaScript in your pages to :

  • make interactions more dynamic ;
  • load page fragments in Ajax;
  • load entire pages in Ajax, and replace only what has changed;
  • submit forms in Ajax;
  • etc.

Florent has been using Symfony UX Turbo (the integration of the Hotwire core into Symfony) since its release. He really appreciates the simplicity of installation and use, especially its maintenance. It takes about 30% less code compared to the API + Frontend JS couple. There are inevitably some negative points, like the naming of some variables or functions. With some contributions from users, DX will improve quickly.

Titouan Galopin talked about content editing with Symfony. There are a lot of techniques to let your users take control of your content and each one has its advantages and drawbacks. He detailed the differences, as well as his favorite: Quill.

This is an editor that will store deltas or “changes ” to a document, in a rendering-agnostic format. So we can generate HTML for the Web, or render in another format, for a native mobile application for example, from the same document. And thanks to deltas, we can easily make a collaborative and real-time platform.

Section intitulée securitySecurity

Our dear Mathieu has presented the new Symfony interface AccessTokenExtractorInterface that allows developers to extract an Access Token from a request to authenticate a user. He started by giving a short summary of the new authentication system. Then he showed how to go from a custom code in Symfony 6.1 to a greatly simplified version in Symfony 6.2. We love it!

Robin Chalas came to talk about the future of OAuth2.1 which will be named OAuth3.0 GNAP. It’s pronounced “nap”. OAuth 1 & 2 suffer from several problems and the authors of this protocol went back to work to propose a new version:

  • more straightforward;
  • more secured;
  • easier to implement;
  • easier to deploy;
  • not tightly coupled to a browser (mobile, IoT, bot, etc).

This protocol, initiated more than two years ago, is still in draft. But it is becoming quite stable. The last 2 meetings of the team didn’t result in any protocol evolution! We look forward to playing with it.

Section intitulée symfonySymfony

Alexander M. Turek showed how to embed a legacy application in a Symfony application to modernize it. We use the same technique at JoliCode! If you are dealing with a legacy application, we advise you to watch his presentation which is very complete.

Our also dear Marion presented the Validator component in depth, and especially how to validate data dynamically. We had already blogged about it.

Section intitulée conclusionConclusion

Those of us who were speakers had a good experience: the main stage was very intimidating but the stage managers were lovely, and the audience was supportive. We talked a lot with people in the audience after the talks and it’s so satisfying to get immediate feedback that our presentation provided answers! If you haven’t already tried it as a speaker, you are highly encouraged to try it at one of these events.

SymfonyCon is a great opportunity to meet or reconnect with developers and contributors from all over the world, something we missed. We can’t wait to meet again in Brussels next year!


Cet article porte sur la conférence SymfonyCon Disneyland Paris 2022.

SymfonyCon Disneyland Paris 2022

Commentaires et discussions

Ces clients ont profité de notre expertise