Laravel 10.42 - Global Defaults for the HTTP Client, a Max Validation Rule for Passwords, and more
Last updated on by Paul Redmond
This week, the Laravel team released v10.42 with global default options for the HTTP client, a max validation rule for the password rule object, a string unwrap helper, and more.
Global Default Options for the HTTP Client
Tim MacDonald contributed the ability to configure global default options for the HTTP client via a service provider:
Http::globalOptions([ 'timeout' => 5, 'connect_timeout' => 2,]);
If you call the globalOptions
method more than once, it will override the original global configuration on subsequent calls.
String Unwrap Helper
Steve Bauman contributed a Str::unwrap()
method which you can use to unwrap strings:
// UnquoteStr::unwrap('"Unquote"', '"');// `Unquote` // some: "json"Str::unwrap('{ some: "json" }', '{', '}');// ` some: "json" `
Add Multiple Channels/Routes to at Once
D. Nagy Gergő contributed the ability to configure multiple routes at once for on-demand notifications:
NotificationFacade::routes([ 'mail' => ['example@test.local' => 'Test Customer'], 'vonage' => '+3620123456',])->notify(new OrderStatusChanged($order));
New JobQueueing Event
Daniel Mason contributed a JobQueueing
event to the framework that is fired before a job is sent to the queue provider. Here’s a rough example of where this event is instantiated, which includes the $connectionName
, $job
, and $payload
:
use Illuminate\Queue\Events\JobQueueing; new JobQueueing($this->connectionName, $job, $payload));
Max Validation Rule for Passwords
Jeremy Angele contributed a max length validation rule to the Password rule object. This is useful when defining a default password rule:
// BeforePassword::min(8)->rules('max:32'); // New max() methodPassword::min(8)->max(32);
Release notes
You can see the complete list of new features and updates below and the diff between 10.41.0 and 10.42.0 on GitHub. The following release notes are directly from the changelog:
v10.42.0
- [10.x] Switch to hash_equals in
File::hasSameHash()
by @simonhamp in https://github.com/laravel/framework/pull/49721 - [10.x] fix Rule::unless for callable $condition by @dbakan in https://github.com/laravel/framework/pull/49726
- [10.x] Adds JobQueueing event by @dmason30 in https://github.com/laravel/framework/pull/49722
- [10.x] Fix decoding issue in MailLogTransport by @rojtjo in https://github.com/laravel/framework/pull/49727
- [10.x] Implement "max" validation rule for passwords by @angelej in https://github.com/laravel/framework/pull/49739
- [10.x] Add multiple channels/routes to AnonymousNotifiable at once by @iamgergo in https://github.com/laravel/framework/pull/49745
- [10.x] Sort service providers alphabetically by @buismaarten in https://github.com/laravel/framework/pull/49762
- [10.x] Global default options for the http factory by @timacdonald in https://github.com/laravel/framework/pull/49767
- [10.x] Only use
Carbon
if accessed from Laravel or also usesilluminate/support
by @crynobone in https://github.com/laravel/framework/pull/49772 - [10.x] Add
Str::unwrap
by @stevebauman in https://github.com/laravel/framework/pull/49779 - [10.x] Allow Uuid and Ulid in Carbon::createFromId() by @kylekatarnls in https://github.com/laravel/framework/pull/49783
- [10.x] Test Improvements by @crynobone in https://github.com/laravel/framework/pull/49785