Symfony News

Symfony 4.1 curated new features

Symfony 4.1.0 is going to be released later today. 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.1 new features, but here is a curated list of the most relevant changes (this version has a total of 200 new small and big features):

New Components

  • Messenger (sroze) (24411) improved by many other pull requests:
    • Allow to scope handlers per bus (ogizanagi, sroze) 27275
    • Uses custom method names for handlers (sroze) 27034
    • Add debug:messenger CLI command (ro0NL, sroze) 26803
    • Support configuring messages when dispatching (ogizanagi) 26945
    • Add a time limit receiver (sdelicata) 27130
    • Add a memory limit option for ConsumeMessagesCommand (sdelicata) 26975
    • Define multiple buses from the framework.messenger.buses configuration (sroze) 26864
    • Allow to configure the transport (sroze) 26941
    • Add AMQP adapter (sroze) 26632
    • Add a MessageHandlerInterface (multiple messages + auto-configuration) 26685 (sroze)
    • Add a middleware that validates messages (Nyholm) 26648
    • Add a middleware that wraps all handlers in one Doctrine transaction. (Nyholm) 26647
    • Clone messages to show in profiler (Nyholm) 26650

Console

  • Add box-double table style (maidmaid) 26693
  • Add box style table (maidmaid) 25301
  • Modify console output and print multiple modifyable sections (pierredup) 24363
  • Add option to automatically run suggested command if there is only 1 alternative (pierredup) 25732

DependencyInjection

  • Validate env vars in config (ro0NL) 23888
  • Add a simple CSV env var processor (dunglas) 25627
  • Allow binary values in parameters (bburnichon) 25928
  • Anonymous services in PHP DSL (unkind) 24632
  • Add support for variadics in named arguments (PabloKowalczyk) 24937

Form

  • Add choice_translation_locale option for Intl choice types (yceruto, fabpot) 26825
  • Add a data_help method in Form (mpiot, Nyholm) 26332
  • Ability to set rounding strategy for MoneyType (syastrebov) 26767

FrameworkBundle

  • Add PSR-11 "ContainerBag" to access parameters as-a-service (nicolas-grekas, sroze) 25288
  • Add ControllerTrait::getParameter() (chalasr) 25439
  • Add support to 307/308 HTTP status codes in RedirectController (ZipoKing) 26213
  • Deprecate bundle:controller:action and service:method notation (Tobion) 26085
  • Allow fetching private services from test clients (nicolas-grekas) 26499
  • Add command to delete an item from a cache pool (pierredup) 26223
  • framework.php_errors.log now accept a log level (Simperfit) 26504
  • Keep query in redirect (Simperfit) 26281
  • Add the ability to search a route (Simperfit) 26121
  • Add cache.app.simple psr simple cache (dmaicher) 25710
  • Add email_validation_mode option (xabbuh) 25478
  • Add atom editor to ide config (lexcast) 25415

HttpFoundation

  • Add a migrating session handler (rossmotley) 26096
  • Add HeaderUtils class (c960657) 24699
  • Split FileException into specialized ones about upload handling (fmata) 26475
  • RedisSessionHandler (dkarlovi) 24781

Process

  • Introduce signaled process specific exception class (Soullivaneuh) 25775
  • Make PhpExecutableFinder look for the PHP_BINARY env var (nicolas-grekas) 25629
  • Create a "isTtySupported" static method (nesk) 25142

Routing

  • Allow no-slash root on imported routes (nicolas-grekas) 26284
  • Allow inline definition of requirements and defaults (nicolas-grekas) 26518
  • Implement i18n routing (frankdejonge, nicolas-grekas) 26143
  • Match 77.7x faster by compiling routes in one regexp (nicolas-grekas) 26059
  • Parse PHP constants in YAML routing files (ostrolucky) 25293

Serializer

  • Cache the normalizer to use when possible (dunglas, nicolas-grekas) 27049
  • Allow to access to the context and various other infos in callbacks and max depth handler (dunglas) 27017
  • Added a ConstraintViolationListNormalizer (lyrixx) 22150
  • Ignore comments when decoding XML (q0rban) 26445
  • Add a MaxDepth handler (dunglas) 26108
  • add a constructor argument to return csv always as collection (Simperfit) 25218
  • add a context key to return always as collection for XmlEncoder (Simperfit) 25369
  • Fix security issue on CsvEncoder about CSV injection (welcoMattic) 24508
  • default_constructor_arguments context option for denormalization (Nek-) 25493
  • Serialize and deserialize from abstract classes (sroze) 24375
  • Parse PHP constants in YAML mappings (ostrolucky) 25294

Twig

  • Make csrf_token() usable without forms (xabbuh) 25197
  • Add priority to twig extensions (Brunty) 24777
  • Do not normalize array keys in twig globals (lstrojny) 26770
  • Deprecate "false" in favor of "kernel.debug" as default value of "strict_variable" (yceruto) 25780

Security

  • Allow using custom function inside allow_if expressions (dmaicher) 26660
  • Deprecate AdvancedUserInterface (iltar) 23508
  • Add configuration for Argon2i encryption (CoalaJoe) 26175
  • Make security.providers optional (MatTheCat) 26787

Validator

  • Html5 Email Validation (PurpleBooth) 24442
  • Deprecated "checkDNS" option in Url constraint (ro0NL) 25516
  • Deprecate use of Locale validation constraint without setting "canonicalize" option to true (phansys) 26075
  • Support protocolless URLs validation (MyDigitalLife) 24308
  • Add canonicalize option for Locale validator (phansys) 22353
  • Add option to pass custom values to Expression validator (ostrolucky) 25504

VarDumper

  • Add dd() helper == dump() + exit() (nicolas-grekas) 26970
  • Introduce a new way to collect dumps through a server dumper (ogizanagi, nicolas-grekas) 23831
  • Provide binary, allowing to start a server at any time (ogizanagi) 26654
  • Add a GMP caster in order to cast GMP resources into string or integer (Simperfit) 25237

WebProfiler

  • Live duration of AJAX request (ostrolucky) 26668
  • Expose dotenv variables (ro0NL) 25166
  • Make WDT follow ajax requests if header set (jeffreymb) 26655
  • Display the missing translation panel by default (javiereguiluz) 26398
  • Display orphaned events in profiler (kejwmen) 24392

Workflow

  • Added a new 'all' method on the registry (alexpozzi, lyrixx) 26656
  • Added a TransitionException (andrewtch, lyrixx) 26651
  • Add a MetadataStore to fetch some metadata (lyrixx) 26092
  • Add transition blockers (d-ph, lyrixx) 26076
  • Remove constraints on transition/place name (lyrixx) 26079
  • Add PlantUML dumper to workflow:dump command (Plopix) 24705
  • Workflow name as graph label (shdev) 25148
  • Introduce a Workflow interface (Simperfit) 24751

Miscellaneous

  • [Lock] Add a TTL to refresh lock (jderusse) 26232
  • [Monolog] Add a Monolog activation strategy for ignoring specific HTTP codes (simshaun, fabpot) 23707
  • [LDAP] Allow adding and removing values to/from multi-valued attributes (jean-gui) 21856
  • [BrowserKit] Add a way to switch to ajax for one request (Simperfit) 24778
  • [HttpKernel] Add Kernel::getAnnotatedClassesToCompile() (nicolas-grekas) 27168
  • [HttpKernel] LoggerDataCollector: splitting logs on different sub-requests (vtsykun) 23659
  • [HttpKernel] Make session-related services extra-lazy (nicolas-grekas) 25836
  • [Intl] Add polyfill for Locale::canonicalize() (nicolas-grekas) 26152
  • [Translation] Added support for name on the unit node (Nyholm) 26149
  • [PropertyInfo] Add hassers for accessors prefixes (sebdec) 23617
  • Unwrap errors in FlattenException (derrabus) 26028
  • More compact display of vendor code in exception pages (javiereguiluz) 26671
  • Add clean option to assets install command (robinlehrmann) 24216

You can read more about this new version by reading the Living on the Edge articles on 4.1 on this blog. Also read the UPGRADE guide for Symfony 4.1.

Want to upgrade to this new release? Fortunately, because Symfony protects backwards-compatibility very closely, this should be quite easy. Read our upgrade documentation to learn more.

Want to be notified whenever a new Symfony release is published? Or when a version is not maintained anymore? Or only when a security issue is fixed? Consider subscribing to the Symfony Roadmap Notifications.


Be trained by Symfony experts - 2018-05-30 Paris - 2018-06-4 Clichy - 2018-06-4 Clichy


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