New in Symfony 7.2: New Command Options

In Symfony 7.2, we’ve improved many existing commands with new options and features.

Resolve Env Vars when Linting the Container

Contributed by
Gabriel Ostrolucký
in
#58199

The lint:container command runs some checks to validate the service container configuration.
However, it doesn’t check if all the environment variables used in your services are defined.

For example, if you define an env var for some environment (e.g. dev or staging)
but forget to define it in production, you’ll see an exception when the application
is already deployed. In Symfony 7.2 we’re adding the following option so you can
check that all the required env vars are also defined:

$ php bin/console lint:container –resolve-env-vars

Messenger Stats in Different Formats

Contributed by
Sem Schidler
in
#57426

The messenger:stats command displays information about the number of
queued messages per transport. Unlike other Symfony commands, it doesn’t
provide its output in different formats. In 7.2, we improved this command to add
support for json and text formats:

$ php bin/console messenger:stats –format=json
$ php bin/console messenger:stats my_transport_name other_transport_name –format=json

Better Exit Code when Decrypting Secrets


Contributed by
dciprian-petrisor
and Christian Flothmann
in
#57670
and #57797

The secrets:decrypt-to-local command decrypts all the Symfony secrets
and stores them in the local vault. However, when decryption fails for any reason
(e.g. you didn’t set an env var for the decryption key), the command prints some
error messages but exists with a successful status code.

In Symfony 7.2, when the command fails for any reason, the exist status will be
1 so you can detect that error and handle it correctly.

Allow to Skip Failed Messages

Contributed by
Thibaut Chieux
in
#57270

The messenger:failed:retry command allows you to view and retry failed messages.
For each message, it provides two options: either retry it right now or delete it.
However, sometimes you know you don’t want to delete it but aren’t sure about
retrying it right away.

That’s why in Symfony 7.2 you’ll see a third option: skip it for now, so you
can later decide what to do with it.

Asset Debugging Filters

Contributed by
Simon André
in
#58141

The debug:asset-map command allows you to display detailed information about
your AssetMapper paths, namespace prefixes, logical paths, etc. As your application
grows, the output of this command becomes less manageable. That’s why in Symfony 7.2
we’ve introduced some options to filter results:

# provide an asset name or dir to only show results that match it
$ php bin/console debug:asset-map bootstrap.js
$ php bin/console debug:asset-map style/

# provide an extension to only show that file type
$ php bin/console debug:asset-map –ext=css

# you can also only show assets in vendor/ dir or exclude any results from it
$ php bin/console debug:asset-map –vendor
$ php bin/console debug:asset-map –no-vendor

# you can also combine all filters (e.g. find bold web fonts in your own asset dirs)
$ php bin/console debug:asset-map bold –no-vendor –ext=woff2

Sponsor the Symfony project.

Symfony Blog

Read More

Latest News

PHP-Releases

PHP 8.4.1 released!

PHP 8.1.31 released!

PHP 8.3.14 released!

PHP 8.2.26 released!

Generated by Feedzy