PHP code example of maximo-perez-villalba / class-properties-reader
1. Go to this page and download the library: Download maximo-perez-villalba/class-properties-reader library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
maximo-perez-villalba / class-properties-reader example snippets
class YourCustomClassRoot
{
private string $propertyString = 'aValueOfTypeString';
private int $propertyInt = 0;
private float $propertyFloat = 0.0;
}
class YourCustomClassNode extends YourCustomClassRoot
{
private bool $propertyBool = false;
private array $propertyArray = [];
}
class YourCustomClassLeaf extends YourCustomClassNode
{
private object ?$propertyObjectOrNull = null;
}
$allProperties = ClassPropertiesReader::getAll(YourCustomClassLeaf::class);
print_r($allProperties);