skrip42 / class-name
class name assistant
v1.0.3
2020-09-11 08:02 UTC
Requires
- php: >=7.1
- doctrine/inflector: ^1.0
This package is auto-updated.
Last update: 2024-11-11 17:19:36 UTC
README
class name assistant top of doctrine/inflector
install:
composer require skrip42/class-name
usage:
//create class name instance $className = new ClassName('Skrip42\ClassName'); //or $className = ClassName::from('Skrip42\ClassName'); //get data from ClassName instance $className->getShortName(); //return 'ClassName'; $className->getNamespace(); //return 'Skrip42'; $className->getName(); //return 'Skrip42\ClassName'; //convert ClassName data $className->toPlural()->getShortName(); //return 'ClassNames' $className->toSingular()->getShortName(); // return 'ClassName' $className->toSnakeCase()->getShortName(); // reutrn class_name $className->toCamelCase()->getShortName(); // return 'ClassName' $className->toLower()->getShortName(); // return 'className' $className->toUpper()->getShortName(); // return 'ClassName'