News

Improved HTTP Client URL Parameter Merging in Laravel 12.33

Published
Improved HTTP Client URL Parameter Merging in Laravel 12.33 image

Release updates

Never miss a Laravel release

Get an email whenever a new Laravel release lands.

The Laravel team released version 12.33.0, introducing a Stringable doesntContain() method, merging (instead of replacing) HTTP client URL parameters, improved broadcast manager resolution errors, and more.

Stringable doesntContain() Method

Michael Contento contributed a doesntContain() method on Stringable to match the Str helper and provide symmetry with the existing contains() method.

$str = str('laravel-news.com');
 
$str->contains('laravel'); // true
$str->doesntContain('laravel'); // false
$str->doesntContain('NEWS'); // true
$str->doesntContain('NEWS', ignoreCase: true); // false

Http Client Merge Parameters

Chris Jones proposed a mergeUrlParameters() method to Http PendingRequest because withUrlParameters replaces all parameters. Instead, Taylor Otwell updated to PR to always merge parameters instead of introducing a new method:

Http::macro('service', function () {
return Http::baseUrl('https://api.example.com')
->withUrlParameters(['version' => 'v1', 'tenant' => 'acme']);
});
 
// Before: <12.33, `version` is removed.
Http::service()->withUrlParameters(['tenant' => 'beta']);
// ['tenant' => 'beta']
 
// After: +12.33, params are merged.
Http::service()->withUrlParameters(['tenant' => 'beta']);
// ['version' => 'v1', 'tenant' => 'beta']

The withUrlParameters() change is non-breaking—if you need to customize URL parameters on a reusable pending request, you can solely provide any parameters you intend to override.

Improve BroadcastManager Error Messages

Mathias Grimm contributed a clearer error message when a broadcast driver fails to initialize:

// Before:
// TypeError: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given
 
// After:
// BroadcastException: Failed to create broadcaster for connection "my-connection" with error:
// Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given

Release notes

You can see the complete list of new features and updates below and the diff between 12.32.0 and 12.33.0 on GitHub. The following release notes are directly from the changelog:

v12.33.0

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

laravelcloud logo
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud

The latest

View all →
CPX: The Composer Package Executor for PHP image

CPX: The Composer Package Executor for PHP

Read article
Laravel AI SDK Adds Human-in-the-Loop Tool Approval image

Laravel AI SDK Adds Human-in-the-Loop Tool Approval

Read article
Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals image

Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals

Read article
Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs image

Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs

Read article
Blade Formatting in Laravel Pint image

Blade Formatting in Laravel Pint

Read article
Inertia DevTools Is Now on the Chrome Web Store image

Inertia DevTools Is Now on the Chrome Web Store

Read article