December 18, 2019 Javier Eguiluz

Password hashing and migration improvements¶ Contributed by

Robin Chalas

in #34020 and #34139. In Symfony 4.3 we introduced the native password encoder to let Symfony select the best algorithm to hash passwords automatically. This is still the recommended setting, but some applications must stick to some specific algorithm for some reasons. That's why in Symfony 4.4 we've un-deprecated all the specific encoders, so you can use them again in your security config: 1 2 3 4 5 6 7 8 9 10 # config/packages/security.yaml security : # ... encoders : App\Entity\User : algorithm : 'argon2i' algorithm : 'argon2id' algorithm : 'auto' algorithm : 'bcrypt' algorithm : 'sodium' Related to this and to password migration, we've added a new migrate_from option to allow encoders define their original algorithm when migrating to a new encoder: 1 2 3 4 5 6 7 # config/packages/security.yaml security : # ... encoders : App\Entity\User : algorithm : 'argon2i' migrate_from : 'bcrypt'

Deprecated WebserverBundle¶ Contributed by

Hamza Amrouche

in #31217. The WebServerBundle is a thin wrapper on top of PHP's built-in web server. A few years ago it was useful to quickly run projects on your local machine. However, since we introduced the Symfony local web server, the WebServerBundle pales in comparison. For starters, WebServerBundle is much slower because it can only serve one request at a time (Symfony's server loads them in parallel). In addition, it's not ready for modern applications because it doesn't support HTTPS, whereas Symfony's server supports that and generates certificates for you automatically. Symfony's server provides many other utilities that you'll need while developing your application locally, such as local domain names, different PHP settings per project and smooth Docker integration. That's why we've deprecated WebServerBundle in Symfony 4.4 (and removed it in Symfony 5.0). As an alternative, use the Symfony server provided when you install Symfony in your computer.

Faster container compilation¶ Contributed by

Nicolas Grekas

in #33701. The service container compilation can take some time in the development environment when the application defines lots of services. When two or more concurrent requests need to compile the container, this can lead to long waits. In Symfony 4.4, we wrapped the container compilation in an opportunistic lock so only the first request compiles it while the other requests wait. In practice this makes the compilation noticeable faster in the development environment.

Simpler YAML redirection config¶ Contributed by

Yonel Ceruto

in #33217. Redirecting to another URL or route in a controller is simple thanks to the classes and shortcuts provided by Symfony. However, configuring an HTTP redirection in YAML files is not that simple because of the verbosity of referring to PHP controllers. For example: 1 2 3 4 5 6 7 8 9 10 11 12 # config/routes.yaml doc_shortcut : path : /doc controller : Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction defaults : route : 'doc_page' legacy_doc : path : /legacy/doc controller : Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction defaults : path : 'https://legacy.example.com/doc' In Symfony 4.4 we improved this a bit by making the RedirectController invokable. The previous routing config looks as follows in Symfony 4.4: 1 2 3 4 5 6 7 8 9 10 11 12 # config/routes.yaml doc_shortcut : path : /doc controller : Symfony\Bundle\FrameworkBundle\Controller\RedirectController defaults : route : 'doc_page' legacy_doc : path : /legacy/doc controller : Symfony\Bundle\FrameworkBundle\Controller\RedirectController defaults : path : 'https://legacy.example.com/doc'