PHP code example of scaleupstack / reflection

1. Go to this page and download the library: Download scaleupstack/reflection 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/ */

    

scaleupstack / reflection example snippets


  use ScaleUpStack\Reflection\Reflection;
  

  Reflection::classByName(string $className) : \ReflectionClass
  Reflection::classByObject(object $object) : \ReflectionClass

  Reflection::propertyOfClass(string $className, string $propertyName) : \ReflectionProperty
  Reflection::propertyOfObject(object $object, string $propertyName) : \ReflectionProperty

  Reflection::allPropertiesOfClass(string $className) : \ReflectionProperty[]
  Reflection::allPropertiesOfObject(object $object) : \ReflectionProperty[]

  Reflection::methodOfClass(string $className, string $methodName) : \ReflectionMethod
  Reflection::methodOfObject(object $object, string $methodName) : \ReflectionMethod

  Reflection::allMethodsOfClass(string $className) : \ReflectionMethod[]
  Reflection::allMethodsOfObject(object $object) : \ReflectionMethod[]
  

  Reflection::getPropertyValue(object $object, string $propertyName) : mixed
  Reflection::getStaticPropertyValue(string $className, string $propertyName) : mixed

  Reflection::setPropertyValue(object $object, string $propertyName, $value) : void
  Reflection::setStaticPropertyValue(string $className, string $propertyName, $value) : void
  

  Reflection::invokeMethod(object $object, string $methodName, array $arguments) : mixed
  Reflection::invokeStaticMethod(string $className, string $methodName, array $arguments) : mixed