The Laravel community is excited as the Laravel team has just released Laravel 10.22, along with a minor update, v10.21.1. These releases introduce several exciting features and improvements that enhance the framework’s capabilities. Let’s dive into some of the key highlights of Laravel 10.22:

ULID Testing Helpers:
Jason Jones has significantly contributed by adding testing helpers for ULID (Universally Unique Lexicographically Sortable Identifier) generation. These helpers make it a breeze to work with ULIDs in your Laravel tests. Here’s a glimpse of what’s now possible:

  • Generate ULIDs using Str::ulid().
  • Customize ULID generation using a closure with Str::createUlidsUsing().
  • Freeze ULID generation and restore it to normal.
  • Generate sequences of ULIDs with ease.

This addition opens up exciting possibilities for those dealing with ULIDs in their projects.

Precognition Testing Helpers:
Peter Fox has introduced testing helpers for Laravel Precognition. With these helpers, you can streamline testing for Laravel Precognition, making it more efficient and reliable.

Enum Support in Validation Rules:
Tim Geisendoerfer has contributed enum support for the Rule::in() and Rule::notIn() validation rules. This enhancement allows you to use enums to define valid values for your fields, improving the type safety of your validation logic.

Here’s an example of how you can use enums with validation rules:

enum Color: string
{
   case RED = 'red';
   case GREEN = 'green';
   case BLUE = 'blue';
}

// Use the Color enum with Rule::in()
Validator::validate(
    ['color' => 'green'],
    [
        'color' => [
            Rule::in([Color::RED, Color::GREEN])
        ]
    ],
);

Release Notes:
For a complete list of changes, you can refer to the release notes:

  • Laravel 10.22.0 (September 5th, 2023):
  • Added ULID testing helpers by @Jasonej.
  • It fixed an issue with table prefix duplication in the DatabaseTruncation trait by @mobidev86.
  • It was fixed a typo in phpdoc block by @back2Lobby.
  • Laravel 10.21.1 (September 4th, 2023):
  • HotFix: Throw captured UniqueConstraintViolationException if there are no matching records on SELECT retry by @mpyw.
  • Added testing helpers for Precognition by @peterfox.
  • GeneratorCommand – Sorting possible models and events by @TWithers.
  • Added Enum Support to the In and NotIn Validation Rules by @geisi.
  • PHP 8.3 Support by @driesvints.
  • Call renderForAssertions in all Mailable assertions by @jamsch.
  • Introduced the requireEnv helper by @lucasmichot.
  • Combine prefix with the table for compileDropPrimary PostgreSQL by @dyriavin.
  • BelongsToMany Docblock Improvements by @crynobone.

You can also explore the detailed changes between Laravel 10.21.0 and 10.22.0 on GitHub.

Laravel 10.22 brings valuable features and enhancements to the Laravel ecosystem, making it an exciting update for developers. Stay tuned for more updates and improvements from the Laravel community!

Tags: