Symfony News

Symfony 4.4 curated new features

Symfony 4.4.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.4 new features, but here is a curated list of the most relevant changes (this version has a total of 250 new small and big features):

New Components

  • ErrorHandler provides tools to manage errors and ease debugging PHP code.

Not a new component, but a nice new feature that might become its component in the 5 series: Secret management

  • Add secrets:* commands to deal with secrets seamlessly (Tobion, jderusse, nicolas-grekas) #33997

HttpFoundation

  • Add a way to anonymize IPs (Seldaek) #32194
  • Improving the request/response format autodetection (yceruto) #32344
  • Precalculate session expiry timestamp (azjezz) #33169
  • Deprecate HeaderBag::get() returning an array and add all($key) instead (Simperfit) #32122
  • Deprecate passing argument to method Request::isMethodSafe() (dFayet) #31658

Console

  • Add support for definition list and horizontal table (lyrixx) #32742
  • Add support for NO_COLOR env var (Seldaek) #34252
  • Add deprecation message for non-int statusCode (jschaedl) #33775
  • Do not leak hidden console commands (m-vo) #33412
  • Don't redraw progress bar more than every 100ms by default (nicolas-grekas) #32424
  • Added Application::reset() (lyrixx) #32418
  • Add ProgressBar::preventRedrawFasterThan() and forceRedrawSlowerThan() methods (ostrolucky) #26339
  • Allow answer to be trimmed by adding a flag (Simperfit) #31626
  • Deprecate not passing dash symbol (-) to STDIN commands (yceruto) #33496

Mailer

  • Add Message-Id to SentMessage when sending an email (fabpot) #33967
  • Add support for multiple mailers (fabpot) #33409
  • Add PHPUnit constraints and assertions for the Mailer (fabpot) #32930
  • Add support for the profiler (fabpot) #32912
  • Change DSN syntax (fabpot) #33494
  • Add ReplyTo option for PostmarkApiTransport (pierregaste) #33883
  • Rename SmtpEnvelope to Envelope (xabbuh) #33562
  • Check email validity before opening an SMTP connection (fabpot) #33471
  • Change the DSN semantics (fabpot) #33424
  • Remove the auth mode DSN option and support in the eSMTP transport (fabpot) #33237
  • Simplify the way TLS/SSL/STARTTLS work (fabpot) #33233
  • Add message events logger (fabpot) #32927
  • Add a name to the transports (fabpot) #32916
  • added debug info to TransportExceptionInterface (fabpot) #32896
  • Logger vs debug mailer (fabpot) #32583
  • Extract transport factory and allow create custom transports (Koc) #31946
  • Overwrite envelope sender and recipients from config (Devristo) #32081

MIME

  • Add S/MIME Support (sstok) #30981
  • Add Address::fromString (gisostallenberg) #33091
  • Remove NamedAddress (fabpot) #33270
  • Add AbstractPart::asDebugString() (fabpot) #32917

VarDumper

  • Display the method we're in when dumping stack traces (nicolas-grekas) #34184
  • Add a support for casting Ramsey/Uuid (lyrixx) #33881
  • Add support for Imagine/Image (lyrixx) #32683
  • Output the location of calls to dump() (ktherage) #31446
  • Display fully qualified title (pavinthan, nicolas-grekas) #33486
  • Allow to configure VarDumperTestTrait casters & flags (ogizanagi) #32463
  • Let browsers trigger their own search on double CMD/CTRL + F (ogizanagi) #32429
  • Caster for HttpClient's response dumps all info (nicolas-grekas) #32026

HttpClient

  • Allow arbitrary JSON values in requests (pschultz) #34216
  • Add support for NTLM authentication (nicolas-grekas) #32231
  • Allow option "buffer" to be a stream resource (nicolas-grekas) #34051
  • Add a canceled state to the ResponseInterface (Toflar) #34044
  • Add $response->cancel() (nicolas-grekas) #31831
  • Add HttpClient::createForBaseUri() (nicolas-grekas) #33973
  • Try using php-http/discovery when nyholm/psr7 is not installed (nicolas-grekas) #33980
  • Async HTTPlug client (Nyholm) #33743
  • Allow enabling buffering conditionally with a Closure (rjwebdev) #32565
  • Add TraceableHttpClient and WebProfiler panel (jeremyFreeAgent) #33015
  • Add "max_duration" option (fancyweb) #32807
  • Add $response->toStream() to cast responses to regular PHP streams (nicolas-grekas) #32290
  • Add HttplugClient for compat with libs that need httplug v1 or v2 (nicolas-grekas) #31976
  • Make Psr18Client implement relevant PSR-17 factories (nicolas-grekas) #31980

Messenger

  • Add DoctrineClearEntityManagerWorkerSubscriber to reset EM in worker (weaverryan) #34156
  • Allow exchange type headers binding (CedrickOka) #32489
  • Use events consistently in worker (Tobion) #34217
  • Extract worker logic to listener and get rid of SendersLocatorInterface::getSenderByAlias (Tobion) #34185
  • Remove "sync" transport and replacing it with config trick (weaverryan) #34069
  • Allow to configure the db index on Redis transport (chalasr) #33856
  • Display real handler if handler is wrapped (DavidBadura) #33113
  • Add support for from_transport attribute on messenger.message_handler tag (ruudk) #33317
  • InMemoryTransport handle acknowledged and rejected messages (tienvx) #32783
  • Attempt to give more useful source info when using HandleTrait (ogizanagi) #32745
  • Add support for auto trimming of redis streams (Toflar) #31825
  • Add handling for delayed message to redis transport (alexander-schranz) #31977

Cache

  • Allow URL DSN in PDO adapters (jderusse) #34057
  • Add Redis Sentinel support (StephenClouse) #31437
  • Add DeflateMarshaller - remove phpredis compression (nicolas-grekas) #34133
  • Add TagAwareMarshaller to optimize data storage when using AbstractTagAwareAdapter (nicolas-grekas) #33939
  • Improve RedisTagAwareAdapter invalidation logic & requirements (andrerom) #33461
  • Add argument $prefix to AdapterInterface::clear() (nicolas-grekas) #32284

Validator

  • Add AutoMapping constraint to enable or disable auto-validation (dunglas) #32107
  • Deprecate CacheInterface in favor of PSR-6 (derrabus) #33459
  • Allow objects implementing __toString() to be used as violation messages (mdlutz24) #31083
  • Add a new constraint message when there is both min and max (Lctrs) #32435
  • Allow to use property paths to get limits in range constraint (Lctrs) #31511
  • Add a Length::$allowEmptyString option to reject empty strings (ogizanagi) #31528
  • Improve TypeValidator to handle array of types (jschaedl) #31351
  • Add compared value path to violation parameters (ogizanagi) #31526
  • Support Bootstrap 4 custom switches (romaricdrigon) #33954

Form

  • Add CountryType option for using alpha3 country codes (creiner) #33791
  • Derive default timezone from reference_date option when possible (yceruto) #32762
  • Use a reference date to handle times during DST (xabbuh) #32718
  • Repeat preferred choices in list of all choices (Seb33300, xabbuh) #32658
  • Deprecate int/float for string input in NumberType (xabbuh) #32130
  • Add new Form WeekType (dFayet) #32061

Twig

  • Add NotificationEmail (fabpot) #33605
  • Add exception as HTML comment to beginning and end of exception_full.html.twig (ruudk) #31514
  • Add show-deprecations option to the lint:twig command (yceruto) #33961
  • Lint all templates from configured Twig paths if no argument was provided (yceruto) #33446
  • Mark all classes extending twig as @final (fabpot) #33269
  • Deprecate error templates for non-html formats and using ErrorHandler as fallback (yceruto) #31398

DomCrawler

  • Add Crawler::matches(), ::closest(), ::outerHtml() (lyrixx) #33144
  • NormalizeWhitespace should be true by default (dunglas) #34151
  • Add a normalizeWhitespace argument to text() method (Simperfit) #32440
  • Add Form::getName() method (JustBlackBird) #31959

Ldap

  • Add security LdapUser and provider (chalasr) #32824
  • Add users extraFields (Simperfit) #31532
  • Add exception for mapping ldap errors (Simperfit) #31547

HttpKernel

  • New welcome page on startup for 4.4 LTS & 5.0 (yceruto) #33189
  • Make ExceptionEvent able to propagate any throwable (nicolas-grekas) #34309
  • Wrap compilation of the container in an opportunistic lock (nicolas-grekas) #33701
  • Compress files generated by the profiler (nicolas-grekas) #33698
  • Add alternative convention for bundle directories (yceruto) #32845

Serializer

  • Encode empty objects as objects, not arrays (mcfedr) #28363
  • Add context options to handle BOM in CSV (malarzm) #33896
  • Allow multi-dimenstion object array in AbstractObjectNormalizer (alediator) #32832

WebProfilerBundle

  • Add clear button to ajax tab (Matts) #31876
  • Select default theme based on user preferences (javiereguiluz) #31919
  • Try to display the most useful panel by default (fancyweb) #33783

Security

  • Comparing roles to detect that users has changed (oleg-andreyev) #31177
  • Add support for opportunistic password migrations (nicolas-grekas) #31843
  • Add MigratingPasswordEncoder (nicolas-grekas) #31597
  • Add migrating encoder configuration (chalasr) #34139
  • Allow to stick to a specific password hashing algorithm (chalasr) #34020
  • Add PasswordEncoderInterface::needsRehash() (nicolas-grekas) #31594
  • Add "anonymous: lazy" mode to firewalls (nicolas-grekas) #33676
  • Deprecate isGranted()/decide() on more than one attribute (wouterj) #33584
  • Make stateful firewalls turn responses private only when needed (nicolas-grekas) #33663
  • Deprecate returning non-boolean values from checkCredentials() (derrabus) #33308

DependencyInjection

  • Generate preload.php file for PHP 7.4 in cache folder (nicolas-grekas) #32032
  • Allow binding iterable and tagged services (lyrixx) #33623
  • Allow dumping the container in one file instead of many files (nicolas-grekas) #32581
  • Deprecates tag !tagged in favor of !tagged_iterator (jschaedl) #31321
  • Add option "ignore_errors: not_found" for imported config files (pulzarraider) #31310
  • Add compiler pass and command to check that services wiring matches type declarations (alcalyn, GuilhemN, nicolas-grekas) #32256
  • Add ability to choose behavior of decorations on non existent decorated services (mtarld) #33854
  • Make the env(base64:...) processor able to decode base64url (nicolas-grekas) #34014
  • Add LazyString for lazy computation of string values injected into services (nicolas-grekas) #34013
  • Enable improved syntax for defining method calls in Yaml (nicolas-grekas) #33779
  • Replace REMOTE_ADDR in trusted proxies with the current REMOTE_ADDR (mcfedr) #33574
  • Add Ability to define a priority method for tagged service (lyrixx) #33628

FrameworkBundle

  • Allow configuring the session handler with a DSN (nicolas-grekas) #34177
  • Sort tagged services (krome162504) #33128
  • Added --sort option for TranslationUpdateCommand (k0d3r1s) #33117
  • Improve the redirect config when using RedirectController (yceruto) #33217
  • Add config translator cache_dir (Raulnet) #32543
  • Add autowiring alias for PSR-14 (nicolas-grekas) #32295
  • Use default_locale as default value for translator.fallbacks (dunglas) #32106
  • Allow creating chained cache pools by providing several adapters (nicolas-grekas) #32294
  • Allow to use the BrowserKit assertions with Panther and API Platform's test client (dunglas) #32207
  • Allow dots in translation domains (jschaedl) #31451

Miscellaneous

  • [CssSelector] Support :only-of-type (jakzal) #33861
  • [Yaml] fix parsing inline YAML spanning multiple lines (xabbuh) #33658
  • [Yaml] Add flag to dump NULL as ~ (OskarStark) #32669
  • [Monolog] Added ElasticsearchLogstashHandler (lyrixx) #32360
  • [EventDispatcher] Allow to omit the event name when registering listeners (derrabus) #33851
  • [EventDispatcher] A compiler pass for aliased userland events (derrabus) #33793
  • [Routing] Deprecate ServiceRouterLoader and ObjectRouteLoader in favor of ContainerLoader and ObjectLoader (fancyweb) #32582
  • [Process] Deprecate Process::inheritEnvironmentVariables() (ogizanagi) #32475
  • [Process] Allow writing portable "prepared" command lines (Simperfit) #32126
  • [WebLink] implement PSR-13 directly (nicolas-grekas) #33122
  • [Intl] Support ISO 3166-1 Alpha-3 country codes (terjebraten-certua) #32988
  • [Dotenv] Use default value when referenced variable is not set (j92) #31546
  • [Translation] XliffLintCommand: allow .xliff file extension (codegain) #32548
  • [Translation] Dump native plural formats to po files (Stadly) #31269
  • [PhpUnitBridge] make the bridge act as a polyfill for newest PHPUnit features (nicolas-grekas) #32922
  • [ExpressionLanguage] Exponential format for number (tigr1991) #34028
  • [WebserverBundle] Deprecate the bundle in favor of symfony local server (Simperfit) #31217
  • [Config] Introduce find method in ArrayNodeDefinition to ease configuration tree manipulation (jschaedl) #31287

Be trained by Symfony experts - 2019-11-18 Lyon - 2019-11-25 Clichy - 2019-11-25 Lille


About us

What a Symfony developer should know about the framework: News, Jobs, Tweets, Events, Videos,...

Resources

Find us on Twitter

Find us on Facebook