mulertech/class-manipulation

This Class manipulate classes

v1.0.4 2024-10-29 21:24 UTC

This package is auto-updated.

Last update: 2025-02-28 21:37:53 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub PHPStan Action Status Total Downloads Test Coverage

This Class manipulate classes

Installation

Two methods to install Application package with composer :

Add to your "composer.json" file into require section :

"mulertech/class-manipulation": "^1.0"

and run the command :

php composer.phar update

Run the command :

php composer.phar require mulertech/class-manipulation "^1.0"

Usage


Get all the Reflection methods of the reflection class given (not include the parents methods or others methods) :
$reflectionMethods = ClassManipulation::getClassReflectionMethods(new ReflectionClass(Foo::class));

Get the class name in lower case :
$className = ClassManipulation::getClassNameLower(/complete/namespace/to/class/ClassName::class);
// classname

Get the properties of a class given (not include the parents properties) :
$properties = ClassManipulation::getClassProperties(/complete/namespace/to/class/ClassName::class);
// ['property1', 'property2']