Laravel 9.32, weekly updates, and 🔥 tip
Laravel 9.32
Lots of new features this week (with a few from me) brings us to Laravel 9.32. Here are the highlights:
- New
env:encrypt
andenv:decrypt
commands in #44034 - Share
WithoutOverlapping
key across jobs in #44227 - Short attribute syntax for Blade Components in #44217
- Add source file to
dd
output in #44211 - Add methods to get request data as
int
orfloat
in #44239 - Add helper to dispatch fake job batches in #44176
- Add methods to cast Stringables in #44238
- Allow signed URLs with custom key resolver in #44254
- Allow enum route bindings to have default values in #44255
- Add odd hour schedule method in #44288
You may review the full branch diff on GitHub for a complete list of changes.
This version bump and update is automated for subscribers to a Shifty Plan. If you don't have one of those, be sure to bump your constraint and run composer update
to get the latest features.
Weekly Journal
Last week I returned to live streaming. This time I made some tiny additions to Laravel's Stringable and HTTP Request classes. All of which were merged and highlighted above.
Thursday I had my wisdom teeth removed. So I was out pretty much the rest of the week. A Human Shift came in Friday to upgrade an application from Laravel 5.3. I worked on that a bit over the weekend.
Otherwise I mostly just did some thinking. One of the things I thought about was converting the Workbench desktop application to a command line tool. The original goal for the desktop application was to bring Shift's automation closer to the developer.
Now I'm wondering if I can get closer. Leaving aside the maintenance of a desktop app, a CLI tool could be more convenient for the developer. In addition, as a CLI tool integration into your workflow might be easier. For example, running it within your own CI tools. Obviously not something you can do with an electron app.
A desktop application makes total sense for something like TinkerWell. It has so many features at this point, it's practically an editor. As a Laravel developer, you likely leave an application like TinkerWell open. I don't think you could say the same about the Shift Workbench.
Anyway, something I'm thinking about. Of course, if you use the Workbench, don't hesitate to reply with your thoughts.
🔥 Tip
The other day I wanted to create an array with keys for each of the Laravel versions and a value of null
. A version matrix of sorts.
I've said before PHP comes with nearly a hundred array and string functions. Initially, you might reach for something like array_combine
. But unfortunately the arguments must be arrays of equal size. So it's not possible for something like this where I want to use the same value.
There's array_fill
, which accepts a range and a value. Nice, but still doesn't work since I have a specific set of keys. Scrolling down to the See Also sections reveals array_fill_keys
.
This is what I want. Its first argument is an array of keys and its second argument is the initial value. So I can generate my Laravel version matrix with:
$versions = array_fill_keys(['6.x', '7.x', '8.x', '9.x'], null);