Symfony 4.2 curated new features

Warning: Symfony 4.2 is no longer supported. Consider upgrading your applications to the most recent Symfony version.

Symfony 4.2.0 is going to be released in a few days. As for any other Symfony minor release, our backward compatibility promise applies and this means that you should be able to upgrade easily without changing anything in your code.

We've already blogged about the great 4.2 new features, but here is a curated list of the most relevant changes (this version has a total of 240 new small and big features):

New Components

  • VarExporter, a component to serialize values to plain PHP code (nicolas-grekas) #28231
  • symfony/contracts, a set of abstractions extracted out of the Symfony components (nicolas-grekas) #27093


The messenger component is still marked as experimental in 4.2.

  • Add a trait for synchronous query & command buses (ogizanagi) #29167
  • make dispatch(), handle() and send() methods return Envelope (nicolas-grekas) #28983
  • Add handled & sent stamps (ogizanagi) #29166
  • remove AllowNoHandlerMiddleware in favor of a constructor argument on HandleMessageMiddleware (nicolas-grekas) #28945
  • make Envelope first class citizen for middleware handlers (nicolas-grekas) #28914
  • rename "envelope items" and move them in the "Stamp" namespace (nicolas-grekas) #28911
  • Change AmqpExt classes constructor signature (fabpot) #28419
  • Uses a messenger serializer, not an individual encoder/decoder (sroze) #28405
  • Add a SenderLocator decoupled from ContainerInterface (fabpot) #28399
  • Trace middleware execution in the profiler (ogizanagi) #27321
  • Uses Symfony Serializer by default for envelope items (sroze) #28270
  • Add a --bus option to the messenger:consume-messages command (chalasr, sroze) #28190
  • Only subscribe to a given bus from the MessageSubscriber (sroze) #28275
  • Support configuring messages when dispatching (ogizanagi) #26945


  • add caster for Memcached (jschaedl) #28622
  • add casters for IntlDateFormatter and IntlCalendar (jschaedl) #28566
  • add caster for IntlTimeZone (jschaedl) #28559
  • add caster for NumberFormatter (jschaedl) #28555
  • add caster for MessageFormatter (nicolas-grekas) #28551
  • Scroll into view when searching (ro0NL) #28854
  • Allow to use a light theme out of the box (ogizanagi) #27261
  • Allow dd() to be called without arguments (SjorsO) #28317
  • New env var to select the dump format (dunglas) #25125
  • make RedisCaster handle RedisCluster and dump all options on all drivers (nicolas-grekas) #28264
  • display the signature of callables (nicolas-grekas) #27768


  • Add stampede protection via probabilistic early expiration (nicolas-grekas) #27009
  • add CacheInterface::delete() (nicolas-grekas) #28718
  • added support for connecting to Redis clusters via DSN (nicolas-grekas) #28713
  • support configuring multiple Memcached servers in one DSN (nicolas-grekas) #28598
  • Add MarshallerInterface allowing to change the serializer, providing a default one that automatically uses igbinary when available (nicolas-grekas) #27645
  • Allow configuring PDO-based cache pools, with table auto-creation on first use (nicolas-grekas) #27694
  • added support for phpredis 4 compression and tcp_keepalive options (nicolas-grekas) #27646
  • Use sub-second accuracy for internal expiry calculations (nicolas-grekas) #27031


  • Added intl message formatter (aitboudad, Nyholm) #27399
  • Use ICU parent locales as fallback locales (thewilkybarkid) #28070
  • allow using the ICU message format using domains with the "+intl-icu" suffix (nicolas-grekas) #28952
  • Added support for multiple files or directories in XliffLintCommand (yceruto) #28522
  • Added support for translation files with other filename patterns (javiereguiluz) #27655
  • marked getFallbackLocales() as internal (boscho87) #28626
  • Register an identity translator as fallback (yceruto) #28523
  • TranslationUpdate change default output to xlf (Alexis BOYER) #27935


  • Add channel log filter (ro0NL) #28934
  • Replay referer URL (ro0NL) #28936
  • Extract server parameters into their own tab (fabpot) #28763
  • Append new ajax request to the end of the list (BoShurik) #27763
  • Show relative path of the template and improving panel view (yceruto) #27978
  • Display uploaded files in the profiler (javiereguiluz) #26946


  • Add a new loadForEnv() method mimicking Ruby's dotenv behavior (dunglas) #28533
  • add a flag to allow env vars override (fmata) #26859


  • Refactor and uniformize the config by introducing a default context (dunglas) #28709
  • allow configuring the serialized name of properties through metadata (fbourigault) #28505
  • Add an option to skip null values (dunglas) #28661
  • Add support for ignoring comments while XML encoding (maidmaid) #28289


  • Deprecate checkMX and checkHost on Email validator (fabpot) #28842
  • New DivisibleBy constraint for testing divisibility (colinodell) #28069
  • Check the BIC country with symfony/intl (sylfabre) #28473
  • Deprecate validating DateTimeInterface in Date/Time/DateTime constraints (ro0NL) #25015


  • Add a PdoStore (jderusse) #27456
  • Add Zookeeper data store (Ganesh Chandrasekaran) #27920
  • Wrap release exception (jderusse) #28538
  • Allow user to specify folder for flock (MaksSlesarenko) #26923


  • Deprecate usage of getRootDir() and kernel.root_dir (fabpot) #28810
  • Deprecate the Kernel name (fabpot) #28809
  • Turn HTTP exceptions to HTTP status codes by default (nicolas-grekas) #27519
  • Better exception page when the controller returns nothing (lyrixx) #27138


  • Deprecate TimezoneType regions option (ro0NL) #28860
  • allow additional HTTP methods in form configuration (alekitto) #26324
  • Added options for separate date/time labels in DateTimeType. (mktcode) #21002
  • Add ability to clear form errors (colinodell) #27580


  • Add support for error ouput in the CommandTester (cdekok) #27434
  • Support max column width in Table (ro0NL) #28373
  • Support formatted text cutting (ro0NL) #22225
  • Add title table (maidmaid) #26933


  • Added support for nesting options definition (yceruto) #27291
  • Introduce ability to deprecate options, allowed types and values (yceruto) #27277


  • Add "wait until callback" feature to process class (Nek-) #27742
  • Add relative path support for PHP_BINARY env var of PhpExecutableFinder (maidmaid) #28303
  • deprecated defining commands as strings (nicolas-grekas) #27821


  • Add voter individual decisions to profiler (l-vo) #27914
  • Add "is_granted()" to security expressions, deprecate "has_role()" (nicolas-grekas) #27305
  • add port in access_control (roukmoute) #28061
  • Deprecate simple_preauth and simple_form in favor of Guard (chalasr) #28693
  • make remember-me cookies auto-secure + inherit their default config from framework.session.cookie_* (nicolas-grekas) #28446
  • Remember me: allow to set the samesite cookie flag (dunglas) #27976
  • No more support for custom anon/remember tokens based on FQCN (Iltar van der Berg) #26981


  • Added a way to inverse a previous sorting (lyrixx) #27967
  • Allow arrays as parameters of some methods for better fluent experience and code readability (jfredon) #27891
  • added "use natural sort" option (vyshkant) #27024


  • Added new methods submitForm and clickLink to Client class (nowiko) #27807
  • Add a way to filter direct children (Einenlum) #28221
  • Allow using non-absolute base URIs (javiereguiluz) #28035


  • Allow autowiring by type + parameter name (nicolas-grekas) #28234
  • Allow autoconfiguring bindings (nicolas-grekas) #27806
  • add ServiceSubscriberTrait (kbond) #27077
  • Allow binding by type+name (nicolas-grekas) #27165


  • Add a new method AbstractController::addLink() (dunglas) #28875
  • Add vscode editor to ide config (lexcast) #28679
  • make debug:autowiring list useful services and their description (nicolas-grekas) #28970
  • Deprecate Controller (sroze) #28243
  • Added new "auto" mode for framework.session.cookie_secure to turn it on when https is used (nicolas-grekas) #28244
  • Add SameSite cookies to FrameWorkBundle (rpkamp) #28168
  • Add LoggerAwareInterface to auto configuration (GaryPEGEOT) #28176
  • allow turning routes to utf8 mode by default (nicolas-grekas) #27774
  • show public/private for aliases in debug:container command (OskarStark) #27551
  • Allow configuring taggable cache pools (nicolas-grekas) #26934


  • [Twig] Added template "name" argument to debug:twig command to find their paths (yceruto) #27981
  • [Twig][Form] Add help_attr (mpiot) #27043
  • [WebServerBundle] Added ability to display the current hostname address if available when binding to (respinoza) #28586
  • [Yaml] Added support for multiple files or directories in LintCommand (yceruto) #28521
  • [HttpFoundation] Make ResponseHeaderBag::makeDisposition static (fabpot) #28807
  • [HttpFoundation] make cookies auto-secure when passing them $secure=null + plan to make it and samesite=lax the defaults in 5.0 (nicolas-grekas) #28447
  • [BrowserKit] Adds support for meta refresh (jhedstrom) #27118
  • [LDAP] Add verbose ext-ldap error if present for easier debugging (scaytrase) #28424
  • [LDAP] Add "applyOperations" method to EntryManager (mablae) #27069
  • [Intl] Blacklist invalid languages (ro0NL) #28833
  • [PropertyInfo] Implement "Collection" types in PhpDocExtractor (popy-dev) #26300
  • [PropertyInfo] Add an extractor to guess if a property is initializable (dunglas) #26997
  • [Routing] Add fallback to cultureless locale for internationalized routes (fancyweb) #27957
  • [Doctrine] type guesser simple json array support (iluuu1994) #24297
  • Added different protocols to be allowed as asset base_url (alexander-schranz) #28476
  • Redesigned the default error page in production (javiereguiluz) #27699
  • [ProxyManagerBridge] allow proxifying interfaces with "lazy: SomeProxifiedInterface" (nicolas-grekas) #27697
  • [Config] deprecate tree builders without root nodes (xabbuh) #27476
  • Display the log context in the debug pages (javiereguiluz) #24151
  • CacheWarmerAggregate handle deprecations logs (ScullWM) #27421
Help the Symfony project!

As with any Open-Source project, contributing code or documentation is the most common way to help, but we also have a wide range of sponsoring opportunities.


I wish I had been so productive like Nicolas. :D
I don't find sense deprecate the Controller , since AbstractController doesn't contain the container, and all documentation of 4.2 use $container, I looks like you want to definitely remove, besides getParameter also says deprecate, then how do you get the configuration parameters? Does it have to be bind? This forces you to inject it which sometimes I don't need.
Okay, I saw how to get the parameters, thank you.

Comments are closed.

To ensure that comments stay relevant, they are closed for old posts.