The Str class also provides three convenient methods for manipulating string capitalization: upper, lower, and title. These are more intelligent versions of the PHP strtoupper, strtolower, and ucwords methods. More intelligent because they can handle UTF-8 input if the multi-byte string PHP extension is installed on your web server. To use them, just pass a string to the method:
echo Str::lower('I am a string.');
// i am a string.
echo Str::upper('I am a string.');
// I AM A STRING.
echo Str::title('I am a string.');
// I Am A String.
echo Str::limit("Lorem ipsum dolor sit amet", 10);
// Lorem ipsu...
echo Str::limit_exact("Lorem ipsum dolor sit amet", 10);
// Lorem i...
echo Str::words("Lorem ipsum dolor sit amet", 3);
// Lorem ipsum dolor...
echo Str::random(32);
echo Str::random(32, 'alpha');
echo Str::plural('user');
// users
echo Str::singular('users');
// user
echo Str::plural('comment', count($comments));
return Str::slug('My First Blog Post!');
// my-first-blog-post
return Str::slug('My First Blog Post!', '_');
// my_first_blog_post