Laravel 8.62, weekly updates, and 🔥 tip

Laravel 8.62

No release last week means lots of new features this week, bringing us to Laravel 8.62.0.

Here are the highlights:

  • Add support for singular Wormhole method names in #38815
  • Dispatch events when maintenance mode is enabled and disabled in #38826
  • Allow request input to be retrieved as a collection in #38832
  • Allow index.blade.php views for anonymous components in #38847
  • Add assertNotSoftDeleted in #38886
  • Add new RefreshDatabaseLazily testing trait in #38861
  • Add --pretend for model:prune command in #38945
  • Make PendingMail conditionable in #38942
  • Add --pest when using the make:test command in #38966

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 Jess made several improvements to the Tests Generator. It now does an even better job of setting up your tests with additional factories and fake data by analyzing your controller actions.

We also resolved some bugs which arose from recent changes in Laravel. Most notably the way the middleware is listed. This broke some automation such as setting up an authenticated user and prefixing the actingAs to requests. I ended up opening a PR parsing middleware into an array which was merged in today's release.

Last week I focused mostly on finishing the Human Shifts which came in. All but one are now in review. I hope to finish the remaining one early next week.

In the process, I had the opportunity to use the Lumen to Laravel Converter. I spent the end of last week also improving the automation for this Shift as well. This hadn't really been updated in a few years. So is was missing some of the latest coding practices and core files.

Despite the improved automation I plan to keep this Shift just $5. In fact, I teased Taylor about making it free if he would kill Lumen. 😈

He also gets a lot of questions about Lumen. It's no secret I think Lumen is dead. But it seems we both agree there's just no need to chose it over Laravel anymore.

This week Jess and I are going to update the Tests Generator to output Pest tests. As noted before, I believe Pest will continue to gain adoption. So I'd like this Shift to have the option of generating Pest tests, instead of PHPUnit classes.

🔥 Tip

I find whenever I use explode, I often use array_filter. This ensures any empty items in the array are removed.

I've grown used to, but still appreciate the flags I can pass to preg_split:

1$values = preg_split(
2 '/,/',
3 $delimited_string,
4 -1,
5 PREG_SPLIT_NO_EMPTY
6);

Despite the regex and defaulting the limit parameter, it allows me to split and filter with one function. With PHP 8, I may use named arguments to improve the readability. 🔥

1$values = preg_split(
2 '/,/',
3 $delimited_string,
4 flags: PREG_SPLIT_NO_EMPTY
5);