php-string-plus
More string helpers for PHP (and Laravel)., (*1)
, (*2)
Usage
Require the package in your composer.json file:, (*3)
"spiegeleye/php-string-plus": "1.3.*", (*4)
In your PHP file add use StrPlus\StrPlus; for convenience., (*5)
Helpers
StrPlus::replace_control_chars($replace, $string), (*6)
Replaces non-printable control characters in $string with $replace., (*7)
StrPlus::single_line($string), (*8)
Converts a multi-line text to a text without line breaks or other non-printable characters. Multiple successive spaces are reduced to one sinle space., (*9)
StrPlus::function html_to_single_line_text($string), (*10)
Converts a HTML formatted block to a plain text one-line string without non-printable characters., (*11)
StrPlus::multi_line_text_to_html($string), (*12)
Converts a multi-line plain text string to a multi-line HTML string where line breaks become <br> tags., (*13)
StrPlus::limit($string, $limit, $end = null, $preserve_words = true), (*14)
Limit string to a number of characters and preserve words where possible (optional; default is true). If $end is not set or null the default character … will be used., (*15)