Laravel 11.38, weekly updates, and deals
Laravel 11.38
We're back to the regular schedule this week with a minor release and a few fast-follow patch releases bringing us Laravel 11.38.2. Here are the highlights:
- Fallback to parent methods on
HasUniqueStringIds
in #54096 - Add
finally
to Pipeline in #54110 - Add
--except
tooptimize
andoptimize:clear
in #54070 - Add
--action
filter toroute:list
in #54135 - Add support for custom broadcasting payloads and channels in #54099
- Add fluent validation rule
Rule::email
in #54067 - Support middleware for specific method in resource routes in #53313
- Add
array
fetch method toFormRequest
andFluent
in #54177
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 continued fixing broken windows. I finally got the CI build passing for Shift. In the process, I did some light refactoring. Mostly things to improve Shift's speed. Most Shifts run in under a minute. Some Shifts which do more static analysis can take longer for large applications. So these refactors not only speed up CI, but real-world Shifts too.
With the remainder of the week I focused on the side-project with JT. We're still doing some of our own alpha testing. Fortunately, I had a few readers reach out to be part of our private beta testing. I have some demos scheduled later this week. If they go well, JT and I might launch a public beta next week.
With the remainder of this week, I'll do my Wednesday livestream. I'm also going to expand Purchasing Power Parity for Shift now that laravelshift.com uses Cloudflare and receives Geolocation headers.
Weekly Tip
Something else I stumbled on when refactoring Shift's logs to private app storage (storage/app/logs
). I did so to remove the coupling between the application and the server. This is a pattern I've followed in the new side-projects, but had lived with this broken window in Shift.
However, testing this proved a bit of a challenge. I assumed Storage::fake()
would fake all Storage
calls. But it only fakes them for the default disk. In the case of Shift, I was now writing a log file to the local
disk and then copying to the s3
disk.
To get the tests passing, I needed to fake both disks. Here's a full example test to ensure the log is sent to S3 even if a Shift fails.
#[Test]public function it_stores_the_log_and_exit_code_on_error(): void{ $order = Order::factory()->create(); Storage::fake('s3'); Storage::fake('logs'); $content = $this->faker()->md5(); Storage::disk('logs')->put('shifts/' . $order->id . '.log', $content); Process::preventStrayProcesses()->fake(['php *' => 2]); try { PerformShift::dispatch($order); } catch (ShiftException) { $order->refresh(); $this->assertSame(OrderStatus::Hold, $order->status); $this->assertSame(ExitCode::SystemError, $order->exit_code); $this->assertNull($order->pull_request_url); Storage::disk('s3')->assertExists('logs/' . $order->product->sku . '/' . $order->id . '.log', $content); }}