May 24, 2018 Javier Eguiluz

During the past months we've published almost 40 blog posts about the main new features of Symfony 4.1. In this article you'll find some of the other small but nice new features.

CSV processor for env vars¶ Contributed by

Kévin Dunglas

in #25627. Although it's not as popular as other formats like JSON and YAML, some apps store their environment variables using the CSV format. In Symfony 4.1 you can use a new csv processor to decode those contents into a PHP array (it uses the str_getcsv() PHP function to do the conversion): 1 2 3 4 parameters: env(some_parameter): 'foo,bar,baz' some_option: %env(csv:some_parameter)% # 'some_option' is array('foo', 'bar', 'baz') in the PHP app Combine this new csv processor with the existing file: processor to parse the CSV encoded env vars stored in some file.

Made ProgressBar::setMaxSteps public¶ Contributed by

Gabriel Ostrolucký

in #26449. In Symfony 4.1 this method is public so you can change the progress bar size dynamically while the app is executing. It's useful for edge cases like showing the upload progress of a big file which hasn't been fully downloaded yet: 1 2 3 4 5 6 7 8 9 10 11 12 use Symfony\Component\Console\Helper\ProgressBar ; $bar = new ProgressBar ( $output ); $bar -> start (); $bar -> setProgress ( 2 ); $bar -> setMaxSteps ( 10 ); $bar -> setProgress ( 5 ); $bar -> setMaxSteps ( 100 ); $bar -> setProgress ( 10 ); $bar -> finish (); This example will display the following progress bars in the terminal: 1 2 3 4 5 0 [----------------------------] 2 [==|-------------------------] 5/10 [==============|-------------] 50% 10/100 [==|-------------------------] 10% 100/100 [============================] 100%