Symfony Roundup Covers Twig 4.0 and Symfony 8.1 DX Updates
Recent posts on the Symfony blog outline updates across Twig 4.0 and Symfony 8.1, with changes aimed at template logic, debugging, testing, routing, cache handling, webhooks, locks, and bundle development. The posts were published between 10 June 2026 and 11 June 2026 by Fabien Potencier and Javier Eguiluz. For Drupal teams, the Twig changes are especially relevant because Drupal.org describes Twig as a PHP template engine used in Drupal theming and says Drupal allows template overrides to control HTML markup.
The Twig 4.0 post says the release reworks the for loop context. In Twig 4.0, loop.last works with arrays, generators, and other Traversable iterators, while loop.length, loop.revindex, and loop.revindex0 remain limited to countable sequences. The update also adds loop.previous, loop.next, loop.changed(), and loop.cycle(), restores conditional for loops, and introduces recursive loops with depth variables and a 50-level guard.
The Symfony 8.1 developer-experience posts cover smaller framework improvements across several components. Part 1 adds a profiler option to copy requests as cURL, improves Web Debug Toolbar accessibility, adds route and scheduler sorting, supports regular expressions for Messenger transport names, allows non-shared services to be mocked in tests, adds flash-message assertions, and moves Messenger stamp timing to the Clock component. Part 2 adds request-header mapping for controller arguments, allows controller instances in security expressions, improves Content Security Policy handling for dumped output, supports custom cache marshallers per pool, makes webhook headers and signing algorithm configurable, scopes lock stores by project, and lets bundles act as compiler passes.


