mathiasverraes/classfunctions
Functions to manipulate class names
Maintainers
1.1.0
2014-07-28 14:39 UTC
Requires
- php: >=5.4
Requires (Dev)
- phpunit/phpunit: 4.*
Suggests
None
Provides
None
Conflicts
None
Replaces
None
MIT f0f8dadf1ab4a71e84dede2adb1ed8a34cef7c34
- Mathias Verraes <mathias.woop@verraes.net>
This package is auto-updated.
Last update: 2026-06-25 03:02:03 UTC
README
PHP Utilities to get different variations of class names
use Verraes\ClassFunctions; // Fully qualified class name of an object, without a leading backslash ClassFunctions\fqcn($object); // Canonical class name of an object, of the form "My.Namespace.MyClass" ClassFunctions\canonical($object); // Underscored and lowercased class name of an object, of the form "my.namespace.my_class" ClassFunctions\underscore($object); // The class name of an object, without the namespace ClassFunctions\short($object);
The above methods also accept strings, and ClassFunctions\fqcn() accepts a canonical
class name as returned from ClassFunctions\canonical().
Free bonus feature:
// Returns an associative array of 'CONSTANT_NAME' => 'value' ClassFunctions\constants('Verraes\ClassFunctions\Tests\MyClass')
Installation
You can install ClassFunctions with Composer:
composer require mathiasverraes/classfunctions
Run composer install or composer update and you're ready to start.
