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

Resolve Env Vars when Linting the Container

Gabriel Ostrolucký
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:

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

Messenger Stats in Different Formats

Sem Schidler
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:

1
2
$ 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

dciprian-petrisor Christian Flothmann
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

Thibaut Chieux
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

Simon André
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:

1
2
3
4
5
6
7
8
9
10
11
12
13
# 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
Published in #Living on the edge