Laravel Advanced String Package


Welcome to the first episode of a new "Creator Spotlight" video series where we interview Laravel developers about the things they are creating. Today we talk with Matt Stenson who created a Laravel Advanced String package that adds extra advanced string manipulation methods to the built-in Str class. This package provides extended functionality on strings, such as advanced password generation, data redaction, and more.
Available Methods
The String methods this package includes are:
advPassword
Generates a random, secure password.
public static function advPassword(
$length = 32,
$letters = true,
$numbers = true,
$symbols = true,
$spaces = false,
$upperLetters = false,
$lowerLetters = false,
$exclude = []
)

charWrap
Wraps a string at a given number of characters regardless of words.
public static function charWrap(
$string,
$length = 80
)

emailDomain
Extracts the domain part of an email address, including subdomains.
public static function emailDomain(
$string
)

readTime
Calculates the read time of a string.
public static function readTime(
$string,
$wpm = 200
)

redactCreditCard
Redacts credit card numbers in a string.
public static function redactCreditCard(
$string,
$redacted = '********',
$exclude = []
)

redactSsn
Redacts Social Security Numbers (SSN) in a string.
public static function redactSsn(
$string,
$redacted = '********',
$dashes = true,
$noDashes = true
)

splitName
Splits a full name into first name, middle name (if present), and last name, removing any prefixes and suffixes. This method can handle both "Firstname Lastname" and "Lastname, Firstname" formats.
public static function splitName(
$name
)

More information
For more info check out the Github Repo for installation details, API docs, and more.

The post Laravel Advanced String Package appeared first on Laravel News.
Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.