Laravel 9.6, weekly updates, and 🔥 tip
Laravel 9.6
Lots this week in Laravel 9.6 since there was no release last week. Since there's so much, I'll highlight the additions:
- Show Closure and Job references in the
schedule:list
in #41494 and #41535 - Add
whenTableHasColumn
andwhenTableDoesntHaveColumn
toSchema
builder in #41517 - Make throttle lock acquisition retry time configurable in #41516
- Allow object, instead of array, when adding to
PendingBatch
in #41475 - Add
hasSubject
method to Mailables in #41575 - Add
hasSameHash
to compare file hashes in filesystem in #41586 - Add
newLine
to Stringable in #41622 - Add
excludeIf
andprohibitedIf
validation methods in #41617 - Add
exclude_with
validation rule in #41691 - Allow model accessors to cache any value in #41673
- Add
countedSequence
to model factory in #41699 - Add
previousPath
toUrlGenerator
in #41661 - Make
JsonResponse
macroable in #41723
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 finished up another Human Shift. This time from Laravel 5.6 to 9.x. I also had a few pairing sessions with fellow Laravel devs reviewing parts of their application.
Jess and I also returned to pairing after a week off. We were able to complete adopting Stringables in blade files. This proved to be a bit of a challenge since there is no formal Blade parser. Blade can't be parser as PHP or HTML.
We came up with a simple solution. It works well and has already proven to be helpful in other tasks, like converting env()
helpers.
This week I need merge a backlog of open PR's from Saurabh. He has been helping with work on laravelshift.com.
After that, I hope to return to the Remove dead routes task by the end of the week.
🔥 Tip
Over the last few years I've focused on expanding Shift's services to encompass maintaining Laravel apps rather than just upgrading Laravel apps.
This was the motivation behind the Laravel Fixer and Tests Generator, and more recently the CI Generator and Workbench.
So, inline with the content of this section over the past few newsletters, here's how I'd incorporate each of these into my development workflow.
If my application didn't have a test suite, or an incomplete test suite, I'd start by running the Tests Generator.
Once I had the test suite set up, I'd run the CI Generator to ensure my test suite ran anytime I opened a PR. As well as run any additional automation, like phplint
, phpstan
, etc.
I'd also enable Shift's webhooks to automatically apply the Laravel conventions I like to follow, as well as apply my code style.
This would automate a lot of my development workflow. Ideally freeing up time to write more tests or refactor more code by periodically runnings the tasks within the Workbench or the Laravel Fixer.
All of this creates a positive feedback loop. The more tests you have the more confident you feel in refactoring. The more you refactor the better you feel about your code. The better you feel about your code the more likely you are to keep it up-to-date.