PHP code example of shiroi / think-reflection-annotation

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

    

shiroi / think-reflection-annotation example snippets


//需要反射的类
$class = new TestClass();

//实例化反射类
$factory = \Shiroi\ThinkReflectionAnnotation\reflection\Factory::getInstance($class);
//反射类(类的详情、包含私有方法、私有属性)
var_dump($factory->getClassSubject());

//反射类的方法
var_dump($factory->getMethodsSubject());

//反射类的属性
var_dump($factory->getPropertiesSubject());

//反射类的doc
var_dump($factory->getClassDocComment());

//反射类的方法doc
var_dump($factory->getMethodsDocComment());