InflectorInflector for pluralize and singularize English nouns.
This Inflector is a port of Ruby on Rails Inflector.
It can be really helpful for developers that want to create frameworks based on naming conventions rather than configurations.
It was ported to PHP for the Akelos Framework, a multilingual Ruby on Rails like framework for PHP that will be launched soon.
Located in /Inflector.php (line 38)
camelize (line 222)
Returns given word as CamelCased
Converts a word like "send_email" to "SendEmail". It will remove non alphanumeric character from the word, so "who's online" will be converted to "WhoSOnline"
classify (line 333)
Converts a table name to its class name according to rails naming conventions.
Converts "people" to "Person"
humanize (line 270)
Returns a human-readable string from $word
Returns a human-readable string from $word, by replacing underscores with a space, and by upper-casing the initial character by default.
If you need to uppercase all the words you just have to pass 'all' as a second parameter.
ordinalize (line 351)
Converts number to its ordinal English form.
This method converts 13 to 13th, 2 to 2nd ...
pluralize (line 54)
Pluralizes English nouns.
singularize (line 119)
Singularizes English nouns.
tableize (line 313)
Converts a class name to its table name according to rails naming conventions.
Converts "Person" to "people"
titleize (line 200)
Converts an underscored or CamelCase word into a English sentence.
The titleize function converts text like "WelcomePage", "welcome_page" or "welcome page" to this "Welcome Page". If second parameter is set to 'first' it will only capitalize the first character of the title.
underscore (line 243)
Converts a word "into_it_s_underscored_version"
Convert any "CamelCased" or "ordinary Word" into an "underscored_word".
This can be really useful for creating friendly URLs.
variablize (line 292)
Same as camelize but first char is underscored
Converts a word like "send_email" to "sendEmail". It will remove non alphanumeric character from the word, so "who's online" will be converted to "whoSOnline"
Documentation generated on Sat, 07 Jan 2006 14:12:44 +0100 by phpDocumentor 1.3.0RC3