With the release of Laravel 11.13.0, we have some new additions to the helper functions.

Number::pairs

This function was contributed byhotmeteor

The `Number::pairs()` method allows you to divide a number into pairs based on the minimum and maximum values. This method can handle both integers and floating-point numbers.

$output = Number::pairs(25, 10);
// the first parameter is maximum and second parameter is window.
// [[1, 10], [11, 20], [21, 25]]
// the default offset is 1 but can be changed to 0

$output = Number::pairs(25, 10, 0);
// [[0, 10], [10, 20], [20, 25]]

$output = Number::pairs(10, 2.5, 0)
// [[0, 2.5], [2.5, 5.0], [5.0, 7.5], [7.5, 10.0]]

The use case of the function can be something like https://laravel.com/docs/11.x/queues#dispatching-batches

Here is the link to the PR

Str::chopStart and Str::chopEnd

These functions were contributed bytimacdonald

Str::chopEnd('path/to/file.php', '.php');
// "path/to/file"

Str::chopStart('https://laravel.com', ['https://', 'http://']);
// laravel.com

These "chop" methods will only chop once when the given string exists.

Str::chopStart('https://www.laravel.com', ['https://', 'www.']);
// www.laravel.com
// www was not removed as https:// was found first.

Here is the link to the PR

Add Support for Extensions in Str::markdown

The support for commonmarkextensionshas been added to Str:markdown method bytnylea

public function parseMarkdownFromFile($file_location){

    $markdown_contents = File::get($file_location);
    
    $html = Str::markdown($markdown_contents, [], [
        new AttributesExtension(),
        new TaskListExtension(),
    ]);

    return $html;

}

There is a video associated with the PR.I recommend watching the video for a better understanding of this update.

Check out what was new in laravel 11.12.0

You can see a complete list of release points here.