Symfony 4.2 curated new features
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 <https://github.com/symfony/symfony/pull/28231>
_
- symfony/contracts, a set of abstractions extracted out of the Symfony components (nicolas-grekas)
#27093 <https://github.com/symfony/symfony/pull/27093>
_
Messenger
The messenger component is still marked as experimental in 4.2.
- Add a trait for synchronous query & command buses (ogizanagi)
#29167 <https://github.com/symfony/symfony/pull/29167>
_
- make dispatch(), handle() and send() methods return Envelope (nicolas-grekas)
#28983 <https://github.com/symfony/symfony/pull/28983>
_
- Add handled & sent stamps (ogizanagi)
#29166 <https://github.com/symfony/symfony/pull/29166>
_
- remove AllowNoHandlerMiddleware in favor of a constructor argument on HandleMessageMiddleware (nicolas-grekas)
#28945 <https://github.com/symfony/symfony/pull/28945>
_
- make Envelope first class citizen for middleware handlers (nicolas-grekas)
#28914 <https://github.com/symfony/symfony/pull/28914>
_
- rename "envelope items" and move them in the "Stamp" namespace (nicolas-grekas)
#28911 <https://github.com/symfony/symfony/pull/28911>
_
- Change AmqpExt classes constructor signature (fabpot)
#28419 <https://github.com/symfony/symfony/pull/28419>
_
- Uses a messenger serializer, not an individual encoder/decoder (sroze)
#28405 <https://github.com/symfony/symfony/pull/28405>
_
- Add a SenderLocator decoupled from ContainerInterface (fabpot)
#28399 <https://github.com/symfony/symfony/pull/28399>
_
- Trace middleware execution in the profiler (ogizanagi)
#27321 <https://github.com/symfony/symfony/pull/27321>
_
- Uses Symfony Serializer by default for envelope items (sroze)
#28270 <https://github.com/symfony/symfony/pull/28270>
_
- Add a --bus option to the messenger:consume-messages command (chalasr, sroze)
#28190 <https://github.com/symfony/symfony/pull/28190>
_
- Only subscribe to a given bus from the MessageSubscriber (sroze)
#28275 <https://github.com/symfony/symfony/pull/28275>
_
- Support configuring messages when dispatching (ogizanagi)
#26945 <https://github.com/symfony/symfony/pull/26945>
_
VarDumper
- add caster for Memcached (jschaedl)
#28622 <https://github.com/symfony/symfony/pull/28622>
_
- add casters for IntlDateFormatter and IntlCalendar (jschaedl)
#28566 <https://github.com/symfony/symfony/pull/28566>
_
- add caster for IntlTimeZone (jschaedl)
#28559 <https://github.com/symfony/symfony/pull/28559>
_
- add caster for NumberFormatter (jschaedl)
#28555 <https://github.com/symfony/symfony/pull/28555>
_
- add caster for MessageFormatter (nicolas-grekas)
#28551 <https://github.com/symfony/symfony/pull/28551>
_
- Scroll into view when searching (ro0NL)
#28854 <https://github.com/symfony/symfony/pull/28854>
_
- Allow to use a light theme out of the box (ogizanagi)
#27261 <https://github.com/symfony/symfony/pull/27261>
_
- Allow dd() to be called without arguments (SjorsO)
#28317 <https://github.com/symfony/symfony/pull/28317>
_
- New env var to select the dump format (dunglas)
#25125 <https://github.com/symfony/symfony/pull/25125>
_
- make RedisCaster handle RedisCluster and dump all options on all drivers (nicolas-grekas)
#28264 <https://github.com/symfony/symfony/pull/28264>
_
- display the signature of callables (nicolas-grekas)
#27768 <https://github.com/symfony/symfony/pull/27768>
_
Cache
- Add stampede protection via probabilistic early expiration (nicolas-grekas)
#27009 <https://github.com/symfony/symfony/pull/27009>
_
- add CacheInterface::delete() (nicolas-grekas)
#28718 <https://github.com/symfony/symfony/pull/28718>
_
- added support for connecting to Redis clusters via DSN (nicolas-grekas)
#28713 <https://github.com/symfony/symfony/pull/28713>
_
- support configuring multiple Memcached servers in one DSN (nicolas-grekas)
#28598 <https://github.com/symfony/symfony/pull/28598>
_
- Add MarshallerInterface allowing to change the serializer, providing a default one that automatically uses igbinary when available (nicolas-grekas)
#27645 <https://github.com/symfony/symfony/pull/27645>
_
- Allow configuring PDO-based cache pools, with table auto-creation on first use (nicolas-grekas)
#27694 <https://github.com/symfony/symfony/pull/27694>
_
- added support for phpredis 4 compression and tcp_keepalive options (nicolas-grekas)
#27646 <https://github.com/symfony/symfony/pull/27646>
_
- Use sub-second accuracy for internal expiry calculations (nicolas-grekas)
#27031 <https://github.com/symfony/symfony/pull/27031>
_
Translation
- Added intl message formatter (aitboudad, Nyholm)
#27399 <https://github.com/symfony/symfony/pull/27399>
_
- Use ICU parent locales as fallback locales (thewilkybarkid)
#28070 <https://github.com/symfony/symfony/pull/28070>
_
- allow using the ICU message format using domains with the "+intl-icu" suffix (nicolas-grekas)
#28952 <https://github.com/symfony/symfony/pull/28952>
_
- Added support for multiple files or directories in XliffLintCommand (yceruto)
#28522 <https://github.com/symfony/symfony/pull/28522>
_
- Added support for translation files with other filename patterns (javiereguiluz)
#27655 <https://github.com/symfony/symfony/pull/27655>
_
- marked getFallbackLocales() as internal (boscho87)
#28626 <https://github.com/symfony/symfony/pull/28626>
_
- Register an identity translator as fallback (yceruto)
#28523 <https://github.com/symfony/symfony/pull/28523>
_
- TranslationUpdate change default output to xlf (Alexis BOYER)
#27935 <https://github.com/symfony/symfony/pull/27935>
_
WebProfilerBundle
- Add channel log filter (ro0NL)
#28934 <https://github.com/symfony/symfony/pull/28934>
_
- Replay referer URL (ro0NL)
#28936 <https://github.com/symfony/symfony/pull/28936>
_
- Extract server parameters into their own tab (fabpot)
#28763 <https://github.com/symfony/symfony/pull/28763>
_
- Append new ajax request to the end of the list (BoShurik)
#27763 <https://github.com/symfony/symfony/pull/27763>
_
- Show relative path of the template and improving panel view (yceruto)
#27978 <https://github.com/symfony/symfony/pull/27978>
_
- Display uploaded files in the profiler (javiereguiluz)
#26946 <https://github.com/symfony/symfony/pull/26946>
_
DotEnv
- Add a new loadForEnv() method mimicking Ruby's dotenv behavior (dunglas)
#28533 <https://github.com/symfony/symfony/pull/28533>
_
- add a flag to allow env vars override (fmata)
#26859 <https://github.com/symfony/symfony/pull/26859>
_
Serializer
- Refactor and uniformize the config by introducing a default context (dunglas)
#28709 <https://github.com/symfony/symfony/pull/28709>
_
- allow configuring the serialized name of properties through metadata (fbourigault)
#28505 <https://github.com/symfony/symfony/pull/28505>
_
- Add an option to skip null values (dunglas)
#28661 <https://github.com/symfony/symfony/pull/28661>
_
- Add support for ignoring comments while XML encoding (maidmaid)
#28289 <https://github.com/symfony/symfony/pull/28289>
_
Validator
- Deprecate checkMX and checkHost on Email validator (fabpot)
#28842 <https://github.com/symfony/symfony/pull/28842>
_
- New DivisibleBy constraint for testing divisibility (colinodell)
#28069 <https://github.com/symfony/symfony/pull/28069>
_
- Check the BIC country with symfony/intl (sylfabre)
#28473 <https://github.com/symfony/symfony/pull/28473>
_
- Deprecate validating DateTimeInterface in Date|Time|DateTime constraints (ro0NL)
#25015 <https://github.com/symfony/symfony/pull/25015>
_
Lock
- Add a PdoStore (jderusse)
#27456 <https://github.com/symfony/symfony/pull/27456>
_
- Add Zookeeper data store (Ganesh Chandrasekaran)
#27920 <https://github.com/symfony/symfony/pull/27920>
_
- Wrap release exception (jderusse)
#28538 <https://github.com/symfony/symfony/pull/28538>
_
- Allow user to specify folder for flock (MaksSlesarenko)
#26923 <https://github.com/symfony/symfony/pull/26923>
_
HttpKernel
- Deprecate usage of getRootDir() and kernel.root_dir (fabpot)
#28810 <https://github.com/symfony/symfony/pull/28810>
_
- Deprecate the Kernel name (fabpot)
#28809 <https://github.com/symfony/symfony/pull/28809>
_
- Turn HTTP exceptions to HTTP status codes by default (nicolas-grekas)
#27519 <https://github.com/symfony/symfony/pull/27519>
_
- Better exception page when the controller returns nothing (lyrixx)
#27138 <https://github.com/symfony/symfony/pull/27138>
_
Form
- Deprecate TimezoneType regions option (ro0NL)
#28860 <https://github.com/symfony/symfony/pull/28860>
_
- allow additional HTTP methods in form configuration (alekitto)
#26324 <https://github.com/symfony/symfony/pull/26324>
_
- Added options for separate date/time labels in DateTimeType. (mktcode)
#21002 <https://github.com/symfony/symfony/pull/21002>
_
- Add ability to clear form errors (colinodell)
#27580 <https://github.com/symfony/symfony/pull/27580>
_
Console
- Add support for error ouput in the CommandTester (cdekok)
#27434 <https://github.com/symfony/symfony/pull/27434>
_
- Support max column width in Table (ro0NL)
#28373 <https://github.com/symfony/symfony/pull/28373>
_
- Support formatted text cutting (ro0NL)
#22225 <https://github.com/symfony/symfony/pull/22225>
_
- Add title table (maidmaid)
#26933 <https://github.com/symfony/symfony/pull/26933>
_
OptionsResolver
- Added support for nesting options definition (yceruto)
#27291 <https://github.com/symfony/symfony/pull/27291>
_
- Introduce ability to deprecate options, allowed types and values (yceruto)
#27277 <https://github.com/symfony/symfony/pull/27277>
_
Process
- Add "wait until callback" feature to process class (Nek-)
#27742 <https://github.com/symfony/symfony/pull/27742>
_
- Add relative path support for PHP_BINARY env var of PhpExecutableFinder (maidmaid)
#28303 <https://github.com/symfony/symfony/pull/28303>
_
- deprecated defining commands as strings (nicolas-grekas)
#27821 <https://github.com/symfony/symfony/pull/27821>
_
Security
- Add voter individual decisions to profiler (l-vo)
#27914 <https://github.com/symfony/symfony/pull/27914>
_
- Add "is_granted()" to security expressions, deprecate "has_role()" (nicolas-grekas)
#27305 <https://github.com/symfony/symfony/pull/27305>
_
- add port in access_control (roukmoute)
#28061 <https://github.com/symfony/symfony/pull/28061>
_
- Deprecate simple_preauth and simple_form in favor of Guard (chalasr)
#28693 <https://github.com/symfony/symfony/pull/28693>
_
- make remember-me cookies auto-secure + inherit their default config from framework.session.cookie_* (nicolas-grekas)
#28446 <https://github.com/symfony/symfony/pull/28446>
_
- Remember me: allow to set the samesite cookie flag (dunglas)
#27976 <https://github.com/symfony/symfony/pull/27976>
_
- No more support for custom anon/remember tokens based on FQCN (Iltar van der Berg)
#26981 <https://github.com/symfony/symfony/pull/26981>
_
Finder
- Added a way to inverse a previous sorting (lyrixx)
#27967 <https://github.com/symfony/symfony/pull/27967>
_
- Allow arrays as parameters of some methods for better fluent experience and code readability (jfredon)
#27891 <https://github.com/symfony/symfony/pull/27891>
_
- added "use natural sort" option (vyshkant)
#27024 <https://github.com/symfony/symfony/pull/27024>
_
DomCrawler
- Added new methods submitForm and clickLink to Client class (nowiko)
#27807 <https://github.com/symfony/symfony/pull/27807>
_
- Add a way to filter direct children (Einenlum)
#28221 <https://github.com/symfony/symfony/pull/28221>
_
- Allow using non-absolute base URIs (javiereguiluz)
#28035 <https://github.com/symfony/symfony/pull/28035>
_
DependencyInjection
- Allow autowiring by type + parameter name (nicolas-grekas)
#28234 <https://github.com/symfony/symfony/pull/28234>
_
- Allow autoconfiguring bindings (nicolas-grekas)
#27806 <https://github.com/symfony/symfony/pull/27806>
_
- add ServiceSubscriberTrait (kbond)
#27077 <https://github.com/symfony/symfony/pull/27077>
_
- Allow binding by type+name (nicolas-grekas)
#27165 <https://github.com/symfony/symfony/pull/27165>
_
FrameworkBundle
- Add a new method AbstractController::addLink() (dunglas)
#28875 <https://github.com/symfony/symfony/pull/28875>
_
- Add vscode editor to ide config (lexcast)
#28679 <https://github.com/symfony/symfony/pull/28679>
_
- make debug:autowiring list useful services and their description (nicolas-grekas)
#28970 <https://github.com/symfony/symfony/pull/28970>
_
- Deprecate Controller (sroze)
#28243 <https://github.com/symfony/symfony/pull/28243>
_
- Added new "auto" mode for framework.session.cookie_secure to turn it on when https is used (nicolas-grekas)
#28244 <https://github.com/symfony/symfony/pull/28244>
_
- Add SameSite cookies to FrameWorkBundle (rpkamp)
#28168 <https://github.com/symfony/symfony/pull/28168>
_
- Add LoggerAwareInterface to auto configuration (GaryPEGEOT)
#28176 <https://github.com/symfony/symfony/pull/28176>
_
- allow turning routes to utf8 mode by default (nicolas-grekas)
#27774 <https://github.com/symfony/symfony/pull/27774>
_
- show public/private for aliases in debug:container command (OskarStark)
#27551 <https://github.com/symfony/symfony/pull/27551>
_
- Allow configuring taggable cache pools (nicolas-grekas)
#26934 <https://github.com/symfony/symfony/pull/26934>
_
Miscellaneous
- [Twig] Added template "name" argument to debug:twig command to find their paths (yceruto)
#27981 <https://github.com/symfony/symfony/pull/27981>
_
- [Twig][Form] Add help_attr (mpiot)
#27043 <https://github.com/symfony/symfony/pull/27043>
_
- [WebServerBundle] Added ability to display the current hostname address if available when binding to 0.0.0.0 (respinoza)
#28586 <https://github.com/symfony/symfony/pull/28586>
_
- [Yaml] Added support for multiple files or directories in LintCommand (yceruto)
#28521 <https://github.com/symfony/symfony/pull/28521>
_
- [HttpFoundation] Make ResponseHeaderBag::makeDisposition static (fabpot)
#28807 <https://github.com/symfony/symfony/pull/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 <https://github.com/symfony/symfony/pull/28447>
_
- [BrowserKit] Adds support for meta refresh (jhedstrom)
#27118 <https://github.com/symfony/symfony/pull/27118>
_
- [LDAP] Add verbose ext-ldap error if present for easier debugging (scaytrase)
#28424 <https://github.com/symfony/symfony/pull/28424>
_
- [LDAP] Add "applyOperations" method to EntryManager (mablae)
#27069 <https://github.com/symfony/symfony/pull/27069>
_
- [Intl] Blacklist invalid languages (ro0NL)
#28833 <https://github.com/symfony/symfony/pull/28833>
_
- [PropertyInfo] Implement "Collection" types in PhpDocExtractor (popy-dev)
#26300 <https://github.com/symfony/symfony/pull/26300>
_
- [PropertyInfo] Add an extractor to guess if a property is initializable (dunglas)
#26997 <https://github.com/symfony/symfony/pull/26997>
_
- [Routing] Add fallback to cultureless locale for internationalized routes (fancyweb)
#27957 <https://github.com/symfony/symfony/pull/27957>
_
- [Doctrine] type guesser simple json array support (iluuu1994)
#24297 <https://github.com/symfony/symfony/pull/24297>
_
- Added different protocols to be allowed as asset base_url (alexander-schranz)
#28476 <https://github.com/symfony/symfony/pull/28476>
_
- Redesigned the default error page in production (javiereguiluz)
#27699 <https://github.com/symfony/symfony/pull/27699>
_
- [ProxyManagerBridge] allow proxifying interfaces with "lazy: SomeProxifiedInterface" (nicolas-grekas)
#27697 <https://github.com/symfony/symfony/pull/27697>
_
- [Config] deprecate tree builders without root nodes (xabbuh)
#27476 <https://github.com/symfony/symfony/pull/27476>
_
- Display the log context in the debug pages (javiereguiluz)
#24151 <https://github.com/symfony/symfony/pull/24151>
_
- CacheWarmerAggregate handle deprecations logs (ScullWM)
#27421 <https://github.com/symfony/symfony/pull/27421>
_