Laravel String Helper Function: title

November 16, 2016 —John Koster

This method will convert the given $value to look like a traditional print title. This method essentially will transform the entire $value to its lower cased equivalent and then uppercase the first character of each word it finds. This method may potentially affect the case of every character in the string.

The signature for the title helper method is:

title($value)

1use Illuminate\Support\Str;
2 
3// This Is A Title
4echo Str::title('THIS IS A TITLE');
5 
6// This Is A Title
7echo Str::title('this is a title');
8 
9// This Is A Title
10echo Str::title('ThIs Is a tItle');

#title_case($value)

The title_case helper function is a shortcut to calling Str::title. This function is declared in the global namespace.

Some absolutely amazing
people

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.