Skip to the stories
AI & ML

Symfony 8.2 Adds Workflow Controls, UID Streaming and Notification Improvements

  • Javier Eguiluz
  • 389 reads

Symfony 8.2 makes workflow event exclusions simpler, adds UUID and ULID streaming support, and improves how applications route admin email notifications.

Symfony 8.2 Adds Workflow Controls, UID Streaming and Notification Improvements

Symfony 8.2 makes several everyday framework tasks less brittle: teams can exclude one workflow event without maintaining a full allowlist, stream UUID and ULID value objects directly, and access configured admin recipients through an interface. The release also fixes how email notifications find a sender and moves editor selection toward a setting available earlier in the error handling process.

Ousama Ben Younes

Exclude workflow events without tracking the full list

Symfony’s Workflow component can dispatch events as a transition leaves a state, runs, enters a state, completes, or announces the next transition. Applications can already restrict dispatching with the events_to_dispatch option. That requires listing the events to keep, though, so a new event added by Symfony can change the behavior developers intended.

Symfony 8.2 adds an exclusion form: prefix an event name with !. For example, this configuration disables the announce event while allowing the other workflow events to be dispatched:

framework:
    workflows:
        order:
            type: state_machine
            events_to_dispatch: ['!workflow.announce']

The same syntax works when creating a Workflow directly and passing the $eventsToDispatch constructor argument. That’s useful for applications using the component without the framework’s configuration layer.

Mathias Arlaud

There are two constraints. A list must use either exclusions or a list of events to include; it can’t combine both forms. And the guard event is always dispatched, so trying to exclude workflow.guard is rejected. For teams that need to suppress one noisy or unnecessary event, the new form avoids having to keep an allowlist synchronized with future changes.

JsonStreamer can handle UID value objects

JsonStreamer is designed to read and write JSON with low memory use. Its approach works best with objects made up of public properties, while value objects ordinarily need conversion logic to move between PHP and JSON. Symfony 8.2 supplies built-in transformers for Uuid and Ulid objects from the Uid component, including their child classes, such as UuidV4 and UuidV7.

That means a streamable object can declare these types directly. An order model, for example, can use a UuidV7 for its ID and a Ulid for its tracking code. The transformer handles converting those values to JSON and back, instead of requiring application code to add a custom converter for each property.

Nicolas Grekas

By default, UIDs are serialized in their canonical format. The new uid_format option lets callers choose base58, base32, or rfc4122. This choice matters when the JSON representation needs to match an existing interface or storage convention: teams can set the format as part of the write operation while keeping UID objects in the PHP model.

For existing integrations, the practical check is the serialized representation. A change in format affects the strings written to JSON, so applications should choose the expected format deliberately wherever other systems consume those values.

Admin recipients become available through an interface

The Notifier component has a configured list of admin recipients for notifications such as failed Messenger messages and important log messages. Before 8.2, the method for retrieving that list existed on the concrete Notifier class, but not on NotifierInterface. A service depending on the interface therefore couldn’t retrieve the recipients through its declared dependency.

Pascal CESCON

Symfony 8.2 introduces AdminRecipientsProviderInterface, with a getAdminRecipients() method and an autowiring alias. A monitoring service can inject that interface alongside NotifierInterface, then send a notification to the configured recipients. The separation makes the recipient lookup available to application code without requiring that code to depend on a specific notifier implementation.

There’s a migration detail for custom setups: services that decorate the notifier or provide a custom notifier should implement the new interface. Without it, notifications that expect the admin recipient list are sent without recipients. A matching getAdminRecipients() method without the interface still works for now, but Symfony deprecates that arrangement.

Email notifications can use the global From header

Email notifications previously needed a sender set in the notification’s asEmailMessage() method or through the mailer’s envelope.sender option. A globally configured From header alone wasn’t enough for the email channel, which could raise an exception when asked to send.

In 8.2, the channel uses the global From header if no envelope sender is configured. That makes a shared mailer header sufficient for notifications, too. A sender specified by asEmailMessage() still takes precedence, so notification-specific sender choices continue to work.

Move editor configuration to the environment

Symfony can turn file paths shown on exception pages and in the profiler into links that open files in an editor. Editor selection was available through either framework.ide or the SYMFONY_IDE environment variable. The configuration option could not reach code that runs before the service container is available, which meant some early error pages ignored the selected editor.

Symfony 8.2 deprecates framework.ide and points developers to SYMFONY_IDE, which is read in both early and later code paths. Setting it in .env.local also lets each developer choose their own editor without changing shared project configuration. The deprecation appears only when framework.ide is explicitly set; Symfony plans to remove the option in 9.0.

Taken together, these changes focus on clearer extension points and fewer configuration surprises. Teams upgrading to 8.2 should review workflow event lists, custom notifier services, UID JSON formats, and any explicit framework.ide setting to catch the changes that affect their own code.

Source: Javier Eguiluz · symfony.com

From the same set