src/Reflections/Objects.php
public static function getProperty($object, string $propertyName)
    {
        $reflection = new \ReflectionObject($object);
        $property = $reflection->getProperty($propertyName);
        $property->setAccessible(true);

        return $property->getValue($object);
    }
public static function getProperty($object, string $propertyName)
    {
        $reflection = new \ReflectionObject($object);
        $property = $reflection->getProperty($propertyName);
        $property->setAccessible(true);

        return $property->getValue($object);
    }
public static function getProperty ( $ object , string $ propertyName ) { $ reflection = new \ ReflectionObject ( $ object ) ; $ property = $ reflection -> getProperty ( $ propertyName ) ; $ property -> setAccessible ( true ) ; return $ property -> getValue ( $ object ) ; }
Reads also private and protected properties

@param        $object
@param string $propertyName

@return mixed
Reads also private and protected properties