The text helper is a set of methods to help with the manipulation of strings.
Translit function ua,ru => latin
echo Text::translitIt('Привет');
Removes any leading and traling slashes from a string
echo Text::trimSlashes('some text here/');
Removes slashes contained in a string or in an array
echo Text::strpSlashes('some \ text \ here');
Removes single and double quotes from a string
echo Text::stripQuotes('some "text" here');
Convert single and double quotes to entities
echo Text::quotesToEntities('some "text" here');
Creates a random string of characters.
// Echo's 7GdtAfrIeB2i1PwT
echo Text::random();
// Echo's 886522129
echo Text::random('basic');
// Echo's eeae4b78d203ed75c424db651d025f26
echo Text::random('unique');
// Echo's 8f520ed29e09d569ae28cf2d404a3108a68b6da1
echo Text::random('sha1');
// Echo's olxCWLqexWebYXHI
echo Text::random('alpha');
// Echo's 0072154088176443
echo Text::random('numeric');
// Echo's 9926755998921531
echo Text::random('nozero');
// Echo's WT3AMVUJWCLHC9XM
echo Text::random('distinct');
// Echo's fa2faabc370a36bc
echo Text::random('hexdec');
Cut string
echo Text::cut('Some text here', 5);
Lowercase
echo Text::lowercase('Some text here');
Uppercase
echo Text::uppercase('Some text here');
Get length
echo Text::length('Some text here');
Create a lorem ipsum text
echo Text::lorem(2);
Extract the last `$num` characters from a string.
echo Text::right('Some text here', 4);
Extract the first `$num` characters from a string.
echo Text::left('Some text here', 4);
Replaces newline with
or
.
echo Text::nl2br("Some \n text \n here");
Replaces
and
with newline.
echo Text::br2nl("Some
text
here");
Converts & to & amp;
echo Text::ampEncode("M&CMS;");
Converts & amp; to &.
echo Text::ampDecode("M& amp;CMS");
Convert plain text to html
echo Text::toHtml('test');