PHP code example of 7csn / reflection-collector

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

    

7csn / reflection-collector example snippets


    use chaser\collector\RelectionCollector;
    use Closure;

    # 获取类反射
    ReflectionCollector::class(string $classname): ReflectionClass;
    
    # 获取类方法反射
    ReflectionCollector::method(string $classname, string $methodName): ReflectionMethod;
    
    # 获取类属性反射
    ReflectionCollector::property(string $classname, string $propertyName): ReflectionProperty;
    
    # 获取函数反射
    ReflectionCollector::function(Closure|string $functionOrName): ReflectionFunction;
    

    use chaser\collector\AttributeCollector; 
    use Closure;
    
    # 获取类指定注解反射列表
    AttributeCollector::class(string $classname, string $attributeName): ReflectionAttribute[];
    
    # 获取类方法指定注解反射列表
    AttributeCollector::method(string $classname, string $methodName, string $attributeName): ReflectionAttribute[];
    
    # 获取类属性指定注解反射列表
    AttributeCollector::property(string $classname, string $propertyName, string $attributeName): ReflectionAttribute[];
    
    # 获取函数指定注解反射列表
    AttributeCollector::function(Closure|string $functionOrName, string $attributeName): ReflectionAttribute[];