Text
in package
text helpers
Table of Contents
Constants
- FIRST_LETTER_UPPER = 3
- LOWER_CASE = 1
- UPPER_CASE = 2
Methods
- cleanText() : string
- Clean Text
- convertToTitleCase() : string
- Convert to title (pascal) case
- createToken() : string
- Ceate random token
- mask() : string
- Mask text
- pad() : string
- Pad a string to a certain length with another string (both side)
- padLeft() : string
- Pad left a string to a certain length with another string
- padRight() : string
- Pad right a string to a certain length with another string
- random() : string
- Create random text
- randomString() : string
- Create randowm string
- removeSpecialChars() : string
- Remove special chars and numbers from text
- render() : string
- Replace all code {{ var }} in text with var value
- renderMultiple() : array<string|int, mixed>
- Render multiple text items
- replaceChars() : string
- Replace umlauts chars
- sliceText() : string
- Slice text
- tokenize() : array<string|int, mixed>
- Tokenize text split to words
- transformWord() : string
- Transform word ( removes all not a-z chars )
- ucFirstUtf() : string
- Upper case first letter for Utf8
Constants
FIRST_LETTER_UPPER
public
mixed
FIRST_LETTER_UPPER
= 3
LOWER_CASE
public
mixed
LOWER_CASE
= 1
UPPER_CASE
public
mixed
UPPER_CASE
= 2
Methods
cleanText()
Clean Text
public
static cleanText(string $text) : string
Parameters
- $text : string
Return values
stringconvertToTitleCase()
Convert to title (pascal) case
public
static convertToTitleCase(string $text) : string
Parameters
- $text : string
Return values
stringcreateToken()
Ceate random token
public
static createToken([int $length = 22 ]) : string
Parameters
- $length : int = 22
Return values
stringmask()
Mask text
public
static mask(string $text[, int $len = 5 ][, string $maskChar = '*' ]) : string
Parameters
- $text : string
- $len : int = 5
- $maskChar : string = '*'
Return values
stringpad()
Pad a string to a certain length with another string (both side)
public
static pad(string $input, int $length[, string $char = ' ' ][, bool $htmlSafe = true ]) : string
Parameters
- $input : string
- $length : int
- $char : string = ' '
- $htmlSafe : bool = true
Return values
stringpadLeft()
Pad left a string to a certain length with another string
public
static padLeft(string $input, int $length[, string $char = ' ' ][, bool $htmlSafe = true ]) : string
Parameters
- $input : string
- $length : int
- $char : string = ' '
- $htmlSafe : bool = true
Return values
stringpadRight()
Pad right a string to a certain length with another string
public
static padRight(string $input, int $length[, string $char = ' ' ][, bool $htmlSafe = true ]) : string
Parameters
- $input : string
- $length : int
- $char : string = ' '
- $htmlSafe : bool = true
Return values
stringrandom()
Create random text
public
static random([int $length = 10 ][, string|null $keyspace = null ]) : string
Parameters
- $length : int = 10
- $keyspace : string|null = null
Return values
stringrandomString()
Create randowm string
public
static randomString([int $length = 10 ]) : string
Parameters
- $length : int = 10
Return values
stringremoveSpecialChars()
Remove special chars and numbers from text
public
static removeSpecialChars(string $text[, bool $removeNumbers = false ]) : string
Parameters
- $text : string
- $removeNumbers : bool = false
Return values
stringrender()
Replace all code {{ var }} in text with var value
public
static render(string|null $text[, array<string|int, mixed> $vars = [] ]) : string
Parameters
- $text : string|null
- $vars : array<string|int, mixed> = []
Return values
stringrenderMultiple()
Render multiple text items
public
static renderMultiple(array<string|int, mixed> $items[, array<string|int, mixed> $vars = [] ]) : array<string|int, mixed>
Parameters
- $items : array<string|int, mixed>
- $vars : array<string|int, mixed> = []
Return values
array<string|int, mixed>replaceChars()
Replace umlauts chars
public
static replaceChars(string $text) : string
Parameters
- $text : string
Return values
stringsliceText()
Slice text
public
static sliceText(string $text[, int $maxLength = 30 ]) : string
Parameters
- $text : string
- $maxLength : int = 30
Return values
stringtokenize()
Tokenize text split to words
public
static tokenize(string|array<string|int, mixed> $text, mixed ...$options) : array<string|int, mixed>
Parameters
- $text : string|array<string|int, mixed>
- $options : mixed
Return values
array<string|int, mixed>transformWord()
Transform word ( removes all not a-z chars )
public
static transformWord(string $word, mixed ...$options) : string
Parameters
- $word : string
- $options : mixed
-
1 - case
Return values
stringucFirstUtf()
Upper case first letter for Utf8
public
static ucFirstUtf(string $text) : string
Parameters
- $text : string