New in Symfony 5.4: Misc. features (part 2)
Symfony 5.4 is backed by:
In Symfony 5.4 we're improving this feature to allow you define the HTTP status
code of the response that contains the rendered template (to override the
200 status applied to these responses):
1 2 3 4 5 6 7
# config/routes.yaml upload_started: path: /upload_started.html controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController defaults: template: 'file_upload/started.html.twig' statusCode: 202 # HTTP Status = Accepted
The Symfony DomCrawler component eases DOM navigation for HTML and XML
documents. In Symfony 5.4 we're improving it with a new
It's similar to
text() but it only returns the text that is the direct
descendant of the current node, excluding any child nodes:
1 2 3
$text = $crawler->filterXPath('//body/p')->innerText(); // if content is <p>Foo <span>Bar</span></p> // innerText() returns 'Foo' and text() returns 'Foo Bar'
The Symfony Finder component allows you to apply the
.gitignore rules of
the directory where you are searching. This way you don't need to repeatedly
exclude some files or directories from the search:
1 2 3
// if .gitignore file exists in the directory, its contents // are parsed and applied to the file/dir search $finder->ignoreVCSIgnored(true);
In Symfony 5.4 we've improved this feature to better align with Git's default
behavior. When enabling this feature, the Finder component will use the
.gitignore files of all subdirectories traversed during the search. Also, the
rules of subdirectories always override the parent directories rules.
Configuration based on environment variables is increasingly popular in
Symfony applications. Given that many different files can define and override
those env vars, in Symfony 5.4 we've added a new
debug:dotenv command to help
you debug the value of all your env vars and which
.env files were checked:
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.