What’s new in 3.1
Version 3.1 is mostly a quality release: it adds queue monitoring, makes the router and the configuration stricter, and fixes about eighty bugs across all components.
Queue monitoring
Queues can report more than their size. A monitorable queue gives the age of its oldest waiting job and its number of delayed jobs:
foreach ($manager->getQueues() as $queue) {
printf("%s: %d jobs\n", $queue->getName(), $queue->size());
if ($queue instanceof MonitorableQueueInterface) {
printf(" wait time: %s\n", $queue->waitTime() ?? 'n/a');
printf(" delayed: %s\n", $queue->delayed() ?? 'n/a');
}
}
The queue:size command prints these metrics as a table, as JSON or in the Prometheus format:
$ vendor/bin/berlioz queue:size --format json --total
A new RabbitMqQueue reads these metrics from the RabbitMQ management API.
See Queue Monitoring and
queue:size.
Stricter router
- Host restrictions declared on a group of routes are inherited by its routes.
- Two attributes with the same name in a route path throw a
RoutingException. - Routes without an explicit method also accept
PATCHrequests.
See Router.
Stricter configuration
- Circular references between
{config: ...}expressions are detected and throw aConfigException. - Calling
get()without a key returns the whole configuration. getOrFail()accepts falsy values such as0,falseor an empty string.
See Config.
Other new features
- Service container: auto-wiring tries each type of a union type, and skips intersection types. See Auto-wiring.
- Event manager: a maximum dispatch depth prevents infinite loops when listeners dispatch events. See Event manager.
- Maintenance mode: the
startandenddates of a planned maintenance are applied. See Maintenance mode. - Forms: the
max_elementsoption of collections is enforced when a form is submitted. See Collection. - Controllers: a return value that cannot be encoded as JSON throws a 500 error instead of returning an empty response. See Return values.
Changes to check when you upgrade
- Mailer: a sender address is required: both transports throw a
TransportExceptionwhensetFrom()was not called. Header names and values containing line breaks are rejected. See Mailer. - Event manager: listeners with the highest priority now run first.
- Flash bag: the constructor throws an exception when the session cannot be started. See Flash Bag.
- Queue manager:
QueueManager::stats()is deprecated. See Preparing for version 4.