Laravel’s Str facade provides the mask() method, introduced in version 8.69, which allows you to mask a portion of a string with a repeated character. This is particularly useful for obfuscating sensitive information such as email addresses or credit card numbers
use Illuminate\Support\Str;
$originalString = 'SensitiveData123';
$maskedString = Str::mask($originalString, '*', 8); // Output: '********123'
In this example, the first 8 characters of $originalString are replaced with asterisks, leaving the last three characters visible. This method enhances data security by obscuring sensitive parts of strings.

