--- breadcrumb: - What's new? - Version 3.1 summary-order: 7;99 keywords: - release - new features - "3.1" --- # 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: ```php 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: ```bash $ vendor/bin/berlioz queue:size --format json --total ``` A new `RabbitMqQueue` reads these metrics from the RabbitMQ management API. See [Queue Monitoring](../components/queue-manager.md#queue-monitoring) and [`queue:size`](../cli/queues.md#queuesize). ## 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 `PATCH` requests. See [Router](../components/router.md). ## Stricter configuration - Circular references between `{config: ...}` expressions are detected and throw a `ConfigException`. - Calling `get()` without a key returns the whole configuration. - `getOrFail()` accepts falsy values such as `0`, `false` or an empty string. See [Config](../components/config.md). ## Other new features - **Service container:** auto-wiring tries each type of a union type, and skips intersection types. See [Auto-wiring](../components/service-container.md#auto-wiring). - **Event manager:** a maximum dispatch depth prevents infinite loops when listeners dispatch events. See [Event manager](../components/event-manager.md). - **Maintenance mode:** the `start` and `end` dates of a planned maintenance are applied. See [Maintenance mode](../guides/maintenance.md). - **Forms:** the `max_elements` option of collections is enforced when a form is submitted. See [Collection](../guides/forms/collection.md). - **Controllers:** a return value that cannot be encoded as JSON throws a 500 error instead of returning an empty response. See [Return values](../http/controllers.md#return-values). ## Changes to check when you upgrade - **Mailer:** a sender address is required: both transports throw a `TransportException` when `setFrom()` was not called. Header names and values containing line breaks are rejected. See [Mailer](../components/mailer.md). - **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](../components/flash-bag.md). - **Queue manager:** `QueueManager::stats()` is deprecated. See [Preparing for version 4](../getting-started/upgrading.md#preparing-for-version-4).