The Laravel team released 8.16 last week with an artisan command to take you directly to a database CLI, an excellent progress bar convenience method, and a new Ably broadcaster implementation.
This release was jam-packed with awesome new features, so let’s check out the latest changes in the 8.x branch:
Table of Contents
With Progress Bar Convenience Method
Taylor Otwell contributed the withProgressBar()
convenience method you can use in console commands. Here’s what you might do to create a progress bar straight from the docs:
With this convenience method, it could look like this:
Call Silently
Taylor Otwell contributed a callSilently()
method which is an alias to callSilent
in the CallsCommands
trait. You might find that this reads more clearly:
Release Unique Job Locks Before Processing
Paras Malhotra contributed the ability to release unique job locks before the job processes. The new interface is useful for scenarios where a race condition could exist between job completion and unlocking. To learn more, I’d suggest checking out Pull Request #35255 to the framework and the documentation pull request.
Ably Broadcaster
Taylor Otwell contributed an AblyBroadcaster
for broadcasting real-time, live-updating user interfaces. Developers can now pick from Pusher, Redis, and Ably for real-time communication needs. For a refresher, check out the Broadcasting documentation on how you can get started broadcasting in your Laravel projects.
Support Delaying Notifications Per Channel
Gergő D. Nagy contributed the ability to delay notification delivery on a per-channel basis instead of one overall delay. Defining delays per channel is useful if you need to delay the same notification differently for email, database, SMS, etc., notifications. You may now optionally call delay()
with an associative array of channels you’d like to delay:
Note that a channel not defined in the array will not have a delay when using the array format.
Allow Array Sorting By Multiple Criteria
johnylemon contributed a sortByMany
method to the Arr
support class, which will sort props in ascending order by default:
Lastly, the PR outlines complex sorting using closures:
Drop Into a Database CLI
Paras Malhotra—who has been contributing a lot of excellent queue features lately—contributed a new artisan command to drop into a database CLI:
The above command will use the database credentials to connect to a MySQL CLI prompt without manually remembering/alias commands. This command should work with mysql
, pgsql
, sqlite
, and sqlsrv
.
Collections splitIn Method
Andrew Brown contributed the splitIn
method, which is similar to split. The distinct difference is that split
makes it so that each chunk never differs in count from another chunk by more than one. Conversely, splitIn
will fill all earlier chunks before allocating the remainder to the final chunk. The pull request has further details on why you might use splitIn
if you’d like to learn more.
Release Notes
You can see the full list of new features and updates below and the diff between 8.15.0 and 8.16.0 on GitHub. The following release notes are directly from the changelog:
v8.16.0
Added
Fixed
Changed
This content was originally published here.