PHP Classes

PHP Naming Convention Converter: Convert names between different conventions

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 120 All time: 9,510 This week: 80Up
Version Licenses PHP version Categories
naming-converter 1.0.0BSD License, Free...5PHP 5, Text processing
Description 

Author

This class can convert names between different conventions.

It provides several functions that can take a strings with names with multiple words using certain conventions to separate the words, and converts the strings to use other conventions.

Currently it can convert word separations between:

- camel case to underscores
- underscores to camel case
- underscores to Pascal case
- camel case to separated words
- camel case to upper case first word character
- camel case to upper case first name character

Picture of Khoa Nguyen
  Performance   Level  
Name: Khoa Nguyen <contact>
Classes: 1 package by
Country: Viet Nam Viet Nam

Example

require_once 'NamingConventionConverter.php';
echo NamingConventionConverter::underscores2Camel('with_underscores'); // withUnderscores
echo NamingConventionConverter::camel2Underscores('camelCased'); // camel_cased
echo NamingConventionConverter::camel2Words('camelCased'); // camel Cased
echo NamingConventionConverter::camel2Ucwords('camelCased'); // Camel Cased
echo NamingConventionConverter::camel2Ucfirst('camelCased'); // Camel cased


  Files folder image Files (2)  
File Role Description
Accessible without login Plain text file demo.php Example demo
Plain text file NamingConventionConverter.php Class source code class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:120
This week:0
All time:9,510
This week:80Up