New in Symfony 3.2: Misc. improvements
This is the last article in the "New in Symfony 3.2" series. Symfony 3.2 will be released at the end of this month after six months of work and several hundreds of pull requests (more than 200 of them labeled as "new features").
The VarDumper component gained lots of new features and improvements in
Symfony 3.2. One of the most interesting additions is the option to return the
dumped contents instead of outputting them. This allows to store the dump into a
string when using the component methods instead of the Twig
1 2 3 4 5 6 7 8 9 10 11
use Symfony\Component\VarDumper\Cloner\VarCloner; use Symfony\Component\VarDumper\Dumper\CliDumper; $cloner = new VarCloner(); $dumper = new CliDumper(); // Before: dump contents $dumper->dump($cloner->cloneVar($variable)); // After: store the dumped contents in a string $result = $dumper->dump($cloner->cloneVar($variable), true);
Allow to compile classes that use annotations¶
A simple way to improve the performance of Symfony applications is to use the
addClassesToCompile() method in your bundles to add some of your classes to
the boostrap file generated by Symfony to lower the I/O file operations.
However, a caveat of this method is that you can't compile classes that use
annotations. In Symfony 3.2, we added a new method called
to allow caching those classes too. An added bonus of compiling the classes with
annotations is that the annotation reader caches are warmed up too.
now support declaring classes using wildcards:
1 2 3 4 5 6 7
$this->addAnnotatedClassesToCompile(array( // classes defined using wildcards '**Bundle\\Controller\\', '**Bundle\\Entity\\', // class defined explicitly using its FQCN 'Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller', ));
Removed dependencies from the FrameworkBundle¶
The Symfony FrameworkBundle turns the decoupled Symfony Components into a web framework. In the previous Symfony versions, this bundle defined lots of hard dependencies with those components.
In Symfony 3.2, we've eliminated lots of hard dependencies, so these components won't be installed in your application if you don't use them: Templating component, Translation component, Asset component, Security Core and Security CSRF components and the Doctrine annotations library.
Added an AST dumper for ExpressionLanguage¶
In Symfony 3.2, the ExpressionLanguage component added a way to dump the AST (Abstract Syntax Tree) of expressions. This will allow to analyze the expressions statically (to validate them, optimize them, etc.) and even to modify those expressions dynamically.
Refactored Twig extensions¶
Starting from Twig 1.26, the implementation of filters, functions and tests can
use a different class than the extension they belong to. In Symfony 3.2, the
most critical Twig extensions have been refactored to implement this feature,
such as HttpKernelExtension, which defines the
Twig functions. In addition, some optimizations have been introduced to not load
Twig extensions when their associated component is not installed.
New in Symfony 3.2: Misc. improvements symfony.com/blog/new-in-symfony-3-2-misc-improvementsTweet this
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.