Stringable
Implements
Uses
Properties
$value string
The underlying string value.
Methods
__construct ( $value ) : void
Create a new instance of the class.
Parameters
- $value string
after ( $search ) : static
Return the remainder of a string after the first occurrence of a given value.
Parameters
- $search string
afterLast ( $search ) : static
Return the remainder of a string after the last occurrence of a given value.
Parameters
- $search string
append ( $values ) : static
Append the given values to the string.
Parameters
- $values array|string
newLine ( $count ) : $this
Append a new line to the string.
Parameters
- $count int
ascii ( $language ) : static
Transliterate a UTF-8 value to ASCII.
Parameters
- $language string
basename ( $suffix ) : static
Get the trailing name component of the path.
Parameters
- $suffix string
charAt ( $index ) : string|false
Get the character at the specified index.
Parameters
- $index int
classBasename ( ) : static
Get the basename of the class path.
before ( $search ) : static
Get the portion of a string before the first occurrence of a given value.
Parameters
- $search string
beforeLast ( $search ) : static
Get the portion of a string before the last occurrence of a given value.
Parameters
- $search string
between ( $from , $to ) : static
Get the portion of a string between two given values.
Parameters
- $from string
- $to string
betweenFirst ( $from , $to ) : static
Get the smallest possible portion of a string between two given values.
Parameters
- $from string
- $to string
camel ( ) : static
Convert a value to camel case.
contains ( $needles , $ignoreCase ) : bool
Determine if a given string contains a given substring.
Parameters
-
$needles
string|iterable
- $ignoreCase bool
containsAll ( $needles , $ignoreCase ) : bool
Determine if a given string contains all array values.
Parameters
-
$needles
iterable
- $ignoreCase bool
dirname ( $levels ) : static
Get the parent directory's path.
Parameters
- $levels int
endsWith ( $needles ) : bool
Determine if a given string ends with a given substring.
Parameters
-
$needles
string|iterable
exactly ( $value ) : bool
Determine if the string is an exact match with the given value.
Parameters
- $value Stringable |string
excerpt ( $phrase , $options ) : string|null
Extracts an excerpt from text that matches the first instance of a phrase.
Parameters
- $phrase string
- $options array
explode
(
$delimiter
,
$limit
)
:
Illuminate\...\Collection
Explode the string into an array.
Parameters
- $delimiter string
- $limit int
split
(
$pattern
,
$limit
,
$flags
)
:
Illuminate\...\Collection
Split a string using a regular expression or by length.
Parameters
- $pattern string|int
- $limit int
- $flags int
finish ( $cap ) : static
Cap a string with a single instance of a given value.
Parameters
- $cap string
is ( $pattern ) : bool
Determine if a given string matches a given pattern.
Parameters
-
$pattern
string|iterable
isAscii ( ) : bool
Determine if a given string is 7 bit ASCII.
isJson ( ) : bool
Determine if a given string is valid JSON.
isUrl ( ) : bool
Determine if a given value is a valid URL.
isUuid ( ) : bool
Determine if a given string is a valid UUID.
isUlid ( ) : bool
Determine if a given string is a valid ULID.
isEmpty ( ) : bool
Determine if the given string is empty.
isNotEmpty ( ) : bool
Determine if the given string is not empty.
kebab ( ) : static
Convert a string to kebab case.
length ( $encoding ) : int
Return the length of the given string.
Parameters
- $encoding string|null
limit ( $limit , $end ) : static
Limit the number of characters in a string.
Parameters
- $limit int
- $end string
lower ( ) : static
Convert the given string to lower-case.
markdown ( array $options ) : static
Convert GitHub flavored Markdown into HTML.
Parameters
- $options array
inlineMarkdown ( array $options ) : static
Convert inline Markdown into HTML.
Parameters
- $options array
mask ( $character , $index , $length , $encoding ) : static
Masks a portion of a string with a repeated character.
Parameters
- $character string
- $index int
- $length int|null
- $encoding string
match ( $pattern ) : static
Get the string matching the given pattern.
Parameters
- $pattern string
isMatch ( $pattern ) : bool
Determine if a given string matches a given pattern.
Parameters
-
$pattern
string|iterable
matchAll ( $pattern ) : Illuminate\...\Collection
Get the string matching the given pattern.
Parameters
- $pattern string
test ( $pattern ) : bool
Determine if the string matches the given pattern.
Parameters
- $pattern string
padBoth ( $length , $pad ) : static
Pad both sides of the string with another.
Parameters
- $length int
- $pad string
padLeft ( $length , $pad ) : static
Pad the left side of the string with another.
Parameters
- $length int
- $pad string
padRight ( $length , $pad ) : static
Pad the right side of the string with another.
Parameters
- $length int
- $pad string
parseCallback
(
$default
)
:
array|null>
Parse a Class@method style callback into class and method.
Parameters
- $default string|null
pipe ( callable $callback ) : static
Call the given callback and return a new string.
Parameters
- $callback callable
plural ( $count ) : static
Get the plural form of an English word.
Parameters
- $count int|array|Countable
pluralStudly ( $count ) : static
Pluralize the last word of an English, studly caps case string.
Parameters
- $count int|array|Countable
prepend ( $values ) : static
Prepend the given values to the string.
Parameters
- $values string
remove ( $search , $caseSensitive ) : static
Remove any occurrence of the given string in the subject.
Parameters
-
$search
string|iterable
- $caseSensitive bool
reverse ( ) : static
Reverse the string.
repeat ( int $times ) : static
Repeat the string.
Parameters
- $times int
replace ( $search , $replace , $caseSensitive ) : static
Replace the given value in the given string.
Parameters
-
$search
string|iterable
-
$replace
string|iterable
- $caseSensitive bool
replaceArray ( $search , $replace ) : static
Replace a given value in the string sequentially with an array.
Parameters
- $search string
-
$replace
iterable
replaceFirst ( $search , $replace ) : static
Replace the first occurrence of a given value in the string.
Parameters
- $search string
- $replace string
replaceLast ( $search , $replace ) : static
Replace the last occurrence of a given value in the string.
Parameters
- $search string
- $replace string
replaceMatches ( $pattern , $replace , $limit ) : static
Replace the patterns matching the given regular expression.
Parameters
- $pattern string
- $replace Closure |string
- $limit int
scan ( $format ) : Illuminate\...\Collection
Parse input from a string to a collection, according to a format.
Parameters
- $format string
squish ( ) : static
Remove all "extra" blank space from the given string.
start ( $prefix ) : static
Begin a string with a single instance of a given value.
Parameters
- $prefix string
stripTags ( $allowedTags ) : static
Strip HTML and PHP tags from the given string.
Parameters
- $allowedTags string
upper ( ) : static
Convert the given string to upper-case.
title ( ) : static
Convert the given string to title case.
headline ( ) : static
Convert the given string to title case for each word.
singular ( ) : static
Get the singular form of an English word.
slug ( $separator , $language , $dictionary ) : static
Generate a URL friendly "slug" from a given string.
Parameters
- $separator string
- $language string|null
-
$dictionary
array
snake ( $delimiter ) : static
Convert a string to snake case.
Parameters
- $delimiter string
startsWith ( $needles ) : bool
Determine if a given string starts with a given substring.
Parameters
-
$needles
string|iterable
studly ( ) : static
Convert a value to studly caps case.
substr ( $start , $length , $encoding ) : static
Returns the portion of the string specified by the start and length parameters.
Parameters
- $start int
- $length int|null
- $encoding string
substrCount ( $needle , $offset , $length ) : int
Returns the number of substring occurrences.
Parameters
- $needle string
- $offset int
- $length int|null
substrReplace ( $replace , $offset , $length ) : static
Replace text within a portion of a string.
Parameters
- $replace string|string[]
- $offset int|int[]
- $length int|int[]|null
swap ( array $map ) : static
Swap multiple keywords in a string with other keywords.
Parameters
- $map array
trim ( $characters ) : static
Trim the string of the given characters.
Parameters
- $characters string
ltrim ( $characters ) : static
Left trim the string of the given characters.
Parameters
- $characters string
rtrim ( $characters ) : static
Right trim the string of the given characters.
Parameters
- $characters string
lcfirst ( ) : static
Make a string's first character lowercase.
ucfirst ( ) : static
Make a string's first character uppercase.
ucsplit
(
)
:
Illuminate\...\Collection
Split a string by uppercase characters.
whenContains ( $needles , $callback , $default ) : static
Execute the given callback if the string contains a given substring.
Parameters
-
$needles
string|iterable
- $callback callable
- $default callable|null
whenContainsAll ( array $needles , $callback , $default ) : static
Execute the given callback if the string contains all array values.
Parameters
-
$needles
iterable
- $callback callable
- $default callable|null
whenEmpty ( $callback , $default ) : static
Execute the given callback if the string is empty.
Parameters
- $callback callable
- $default callable|null
whenNotEmpty ( $callback , $default ) : static
Execute the given callback if the string is not empty.
Parameters
- $callback callable
- $default callable|null
whenEndsWith ( $needles , $callback , $default ) : static
Execute the given callback if the string ends with a given substring.
Parameters
-
$needles
string|iterable
- $callback callable
- $default callable|null
whenExactly ( $value , $callback , $default ) : static
Execute the given callback if the string is an exact match with the given value.
Parameters
- $value string
- $callback callable
- $default callable|null
whenNotExactly ( $value , $callback , $default ) : static
Execute the given callback if the string is not an exact match with the given value.
Parameters
- $value string
- $callback callable
- $default callable|null
whenIs ( $pattern , $callback , $default ) : static
Execute the given callback if the string matches a given pattern.
Parameters
-
$pattern
string|iterable
- $callback callable
- $default callable|null
whenIsAscii ( $callback , $default ) : static
Execute the given callback if the string is 7 bit ASCII.
Parameters
- $callback callable
- $default callable|null
whenIsUuid ( $callback , $default ) : static
Execute the given callback if the string is a valid UUID.
Parameters
- $callback callable
- $default callable|null
whenIsUlid ( $callback , $default ) : static
Execute the given callback if the string is a valid ULID.
Parameters
- $callback callable
- $default callable|null
whenStartsWith ( $needles , $callback , $default ) : static
Execute the given callback if the string starts with a given substring.
Parameters
-
$needles
string|iterable
- $callback callable
- $default callable|null
whenTest ( $pattern , $callback , $default ) : static
Execute the given callback if the string matches the given pattern.
Parameters
- $pattern string
- $callback callable
- $default callable|null
words ( $words , $end ) : static
Limit the number of words in a string.
Parameters
- $words int
- $end string
wordCount ( $characters ) : int
Get the number of words a string contains.
Parameters
- $characters string|null
wordWrap ( $characters , $break , $cutLongWords ) : static
Wrap a string to a given number of characters.
Parameters
- $characters int
- $break string
- $cutLongWords bool
wrap ( $before , $after ) : static
Wrap the string with the given strings.
Parameters
- $before string
- $after string|null
dump ( ) : $this
Dump the string.
dd ( ) : never
Dump the string and end the script.
value ( ) : string
Get the underlying string value.
toString ( ) : string
Get the underlying string value.
toInteger ( ) : int
Get the underlying string value as an integer.
toFloat ( ) : float
Get the underlying string value as a float.
toBoolean ( ) : bool
Get the underlying string value as a boolean.
toDate ( $format , $tz ) : Carbon
Get the underlying string value as a Carbon instance.
Parameters
- $format string|null
- $tz string|null
jsonSerialize ( ) : string
Convert the object to a string when JSON encoded.
offsetExists ( mixed $offset ) : bool
Determine if the given offset exists.
Parameters
- $offset mixed
offsetGet ( mixed $offset ) : string
Get the value at the given offset.
Parameters
- $offset mixed
offsetSet ( mixed $offset , mixed $value ) : void
Set the value at the given offset.
Parameters
- $offset mixed
offsetUnset ( mixed $offset ) : void
Unset the value at the given offset.
Parameters
- $offset mixed
__get ( $key ) : mixed
Proxy dynamic properties onto methods.
Parameters
- $key string
__toString ( ) : string
Get the raw string value.