Skip to content
A simple to use text formatter, primarily used for page/blog titles
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Build Status Code Coverage Code Quality Maintainability Latest Version Software License

Title Text Formatter

A simple to use text formatter, primarily used for page/blog titles.


Via Composer

"require": {
    "cmgmyr/title-formatter": "~2.0"


use Cmgmyr\TitleFormatter\TitleFormatter;

$title = "this is a messy title. [can you fix it?]";
$title = TitleFormatter::titleCase($title);
echo $title; // This is a Messy Title. [Can You Fix It?]

Formatting "Rules"

  1. First word in a sentence is capitalized
  2. Last word in a sentence is capitalized
  3. Words within brackets (or similar) are capitalized, similar to rules #1 & #2
  4. Words within the $ignoredWords array should not be capitalized as long as it doesn't conflict with rules #1-#3
  5. Words preceded by multiple special characters should be capitalized: $$$Money
  6. All dashed words should be capitalized: Super-Awesome-Post
  7. Ignore words that already include at least one uppercase letter. We'll assume that the author knows what they're doing: eBay, iPad, McCormick, etc


Please see CONTRIBUTING for details.


If you discover any security related issues, please email Chris Gmyr instead of using the issue tracker.



The MIT License (MIT). Please see License File for more information.

You can’t perform that action at this time.