What's New in Laravel 10.42 - TechvBlogs

What's New in Laravel 10.42

Explore the latest advancements in Laravel with version 10.42! Uncover exciting features, enhancements, and improvements that elevate your web development experience. Stay at the forefront of Laravel innovation with this comprehensive update overview.

Smit Pipaliya - Author - TechvBlogs
Smit Pipaliya

5 months ago

TechvBlogs - Google News

Laravel enthusiasts, rejoice! The latest release, v10.42, brings a host of exciting features and improvements that elevate the framework's capabilities. In this article, we'll dive into the key updates, ranging from global default options for the HTTP client to a max validation rule for password rules. Let's explore these enhancements that are set to make your Laravel experience even better.

Global Default Options for the HTTP Client

Tim MacDonald has significantly contributed to the latest release by introducing the ability to configure global default options for the HTTP client using a service provider. With the new Http::globalOptions method, you can easily set parameters such as timeout and connect timeout, providing a streamlined approach to HTTP client configuration.

    'timeout' => 5,
    'connect_timeout' => 2,

It's worth noting that calling the globalOptions method more than once will override the original global configuration on subsequent calls.

String Unwrap Helper

Steve Bauman has added a handy Str::unwrap() method, offering a convenient way to unwrap strings. Whether you need to remove quotes or unwrap specific characters, this method simplifies string manipulation.

// Unquote
Str::unwrap('"Unquote"', '"');
// Result: `Unquote`

// Unwrap specific characters
Str::unwrap('{ some: "json" }', '{', '}');
// Result: ` some: "json" `

This addition enhances string handling, making your code cleaner and more readable.

Add Multiple Channels/Routes at Once

D. Nagy Gergő has brought a time-saving feature to the table by allowing the configuration of multiple routes at once for on-demand notifications. With NotificationFacade::routes(), you can effortlessly set up various notification channels and routes, simplifying the process of notifying users about important events.

    'mail' => ['[email protected]' => 'Test Customer'],
    'vonage' => '+3620123456',
])->notify(new OrderStatusChanged($order));

This improvement streamlines the notification setup, ensuring a smoother user experience.

New JobQueueing Event

Daniel Mason's contribution to Laravel includes a new JobQueueing event. This event is fired before a job is sent to the queue provider, providing developers with more control over job processing. The event includes essential details such as the connection name, job, and payload.

use Illuminate\Queue\Events\JobQueueing;

new JobQueueing($this->connectionName, $job, $payload);

This addition enhances the flexibility of job processing, allowing for better customization and optimization.

Max Validation Rule for Passwords

Jeremy Angele has addressed a common requirement by introducing a max length validation rule for the Password rule object. This enhancement simplifies the process of defining password rules, especially when specifying both minimum and maximum length constraints.

// Before

// New max() method

This addition provides a more intuitive way to set password validation rules, promoting clean and efficient code.

Release Notes and GitHub Diff

For a comprehensive overview of all the changes in v10.42, you can refer to the official release notes on GitHub. The release includes various improvements, bug fixes, and contributions from the Laravel community.

v10.42.0 Release Highlights:

  • Switch to hash_equals in File::hasSameHash()
  • Fix Rule::unless for callable $condition
  • Adds JobQueueing event
  • Fix decoding issue in MailLogTransport
  • Implement max validation rule for passwords
  • Add multiple channels/routes to AnonymousNotifiable at once
  • Sort service providers alphabetically
  • Global default options for the HTTP factory
  • Only use Carbon if accessed from Laravel or also uses illuminate/support
  • Add Str::unwrap
  • Allow Uuid and Ulid in Carbon::createFromId()
  • Test Improvements

In conclusion, Laravel v10.42 stands as a testament to the community-driven development that continuously enhances the framework's capabilities. From improved HTTP client configuration to streamlined password validation, these updates pave the way for a more efficient and enjoyable Laravel experience. Stay tuned for more exciting developments in the Laravel ecosystem!

Comments (0)


Note: All Input Fields are required.