Ray Lee | 李宗叡
Learn or Die
Published in
Aug 7, 2024

# String chopStart and chopEnd (v11.13)

11.13 新增 String chopStart & chopEnd method

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

// "path/to/file"

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

// laravel.com

# Add Support for Extensions to Str::markdown() and the Stringable Class

11.14 String class 的 markdown feature 加入 extension support

<?php
$html = Str::markdown($markdown_contents, [], [
new AttributesExtension(),
new TaskListExtension(),
]);

$html = str('# My Heading')->markdown(
extensions: [new HeadingPermalinksExtension()]
);

# Add Number::pairs() (v11.13)

11.13 新增 Number::pairs() method,arg1 為 subject,arg2 為 slide window range,ar3 為 window start value

<?php
$output = Number::pairs(25, 10);

// [[1, 10], [11, 20], [21, 25]]

$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]]

# Improvements to the artisan serve Command

Artisan serve console 優化

--

--

Ray Lee | 李宗叡
Learn or Die

It's Ray. I do both backend and frontend, but more focus on backend. I like coding, and would like to see the whole picture of a product.