PHPackages                             wandu/reflection - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wandu/reflection

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

wandu/reflection
================

Reflection Extend Library.

v0.3.0(9y ago)14.3k12MITPHPPHP &gt;=5.5.0

Since Jul 29Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Wandu/Reflection)[ Packagist](https://packagist.org/packages/wandu/reflection)[ RSS](/packages/wandu-reflection/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (5)Used By (2)

Wandu Reflection
================

[](#wandu-reflection)

[![Latest Stable Version](https://camo.githubusercontent.com/fa2cd72c6dba8f59a73c9183222695e71a41618284d904f5a1d4b4f69157f786/68747470733a2f2f706f7365722e707567782e6f72672f77616e64752f7265666c656374696f6e2f762f737461626c652e737667)](https://packagist.org/packages/wandu/reflection)[![Latest Unstable Version](https://camo.githubusercontent.com/7508fd49cf5e8082f3e7fea80d868013424dc905c257ec469170d54c6be46fe0/68747470733a2f2f706f7365722e707567782e6f72672f77616e64752f7265666c656374696f6e2f762f756e737461626c652e737667)](https://packagist.org/packages/wandu/reflection)[![Total Downloads](https://camo.githubusercontent.com/0f16a14b552788e989ba90ad161f7d4861fcda8f9071031213253d4181907445/68747470733a2f2f706f7365722e707567782e6f72672f77616e64752f7265666c656374696f6e2f646f776e6c6f6164732e737667)](https://packagist.org/packages/wandu/reflection)[![License](https://camo.githubusercontent.com/8c104c1a91494581a9f5605166313d96fe6ebba9d83c12d8c282fc43066d3fdd/68747470733a2f2f706f7365722e707567782e6f72672f77616e64752f7265666c656374696f6e2f6c6963656e73652e737667)](https://packagist.org/packages/wandu/reflection)

[![Build Status](https://camo.githubusercontent.com/95e9a5b0eed80e0d6f05b193bb6e3da28281d2ea9bb1b1a9acb676b4ccdf1fdc/68747470733a2f2f7472617669732d63692e6f72672f57616e64752f5265666c656374696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Wandu/Reflection)[![Code Coverage](https://camo.githubusercontent.com/709f7afa9b1bcb943acdc635da6e4b44eaa45d034f05e928785ca9a1c3fec848/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f57616e64752f5265666c656374696f6e2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Wandu/Reflection/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/65c7050f4a766e464cbe5c5b7a8506ded5d1ed76d36938c52ff976a74968aba4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f57616e64752f5265666c656374696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Wandu/Reflection/?branch=master)

Reflection Extend Library.

Installation
------------

[](#installation)

```
$ composer require wandu/reflection

```

Documents
---------

[](#documents)

- [ReflectionCallable](#reflectioncallable)

### ReflectionCallable

[](#reflectioncallable)

It supports 6 types of callable object. (ref. [Wani Blog, Callable](http://blog.wani.kr/posts/2015/05/02/php-something-4-callable/))

1. string of function's name.
2. string of class and static method's name.
3. array of class and static method's name.
4. array of object and method's name.
5. object of class that has `__invoke` method. (ref. [Magic Method `__invoke`](http://php.net/manual/language.oop5.magic.php#object.invoke))
6. object of `Closure`.

and two more.

1. `__call` magic method.
2. `__callStatic` magic method.

```
namespace Wandu\Reflection;

use ReflectionFunctionAbstract;
use Reflector;

class ReflectionCallable extends ReflectionFunctionAbstract implements Reflector {

    /* Method */
    public __construct( callable $callee )
    public mixed __invoke( ...$parameters )
    public string getCallableName()
    public boolean isMagicMethod()
    public int getReflectionType()
    public ReflectionFunctionAbstract getRawReflection()

    /* Inherited methods */
    final private void ReflectionFunctionAbstract::__clone ( void )
    public ReflectionClass ReflectionFunctionAbstract::getClosureScopeClass ( void )
    public object ReflectionFunctionAbstract::getClosureThis ( void )
    public string ReflectionFunctionAbstract::getDocComment ( void )
    public int ReflectionFunctionAbstract::getEndLine ( void )
    public ReflectionExtension ReflectionFunctionAbstract::getExtension ( void )
    public string ReflectionFunctionAbstract::getExtensionName ( void )
    public string ReflectionFunctionAbstract::getFileName ( void )
    public string ReflectionFunctionAbstract::getName ( void )
    public string ReflectionFunctionAbstract::getNamespaceName ( void )
    public int ReflectionFunctionAbstract::getNumberOfParameters ( void )
    public int ReflectionFunctionAbstract::getNumberOfRequiredParameters ( void )
    public array ReflectionFunctionAbstract::getParameters ( void )
    public ReflectionType ReflectionFunctionAbstract::getReturnType ( void )
    public string ReflectionFunctionAbstract::getShortName ( void )
    public int ReflectionFunctionAbstract::getStartLine ( void )
    public array ReflectionFunctionAbstract::getStaticVariables ( void )
    public bool ReflectionFunctionAbstract::hasReturnType ( void )
    public bool ReflectionFunctionAbstract::inNamespace ( void )
    public bool ReflectionFunctionAbstract::isClosure ( void )
    public bool ReflectionFunctionAbstract::isDeprecated ( void )
    public bool ReflectionFunctionAbstract::isGenerator ( void )
    public bool ReflectionFunctionAbstract::isInternal ( void )
    public bool ReflectionFunctionAbstract::isUserDefined ( void )
    public bool ReflectionFunctionAbstract::isVariadic ( void )
    public bool ReflectionFunctionAbstract::returnsReference ( void )
    abstract public void ReflectionFunctionAbstract::__toString ( void )
}
```

(ref. [ReflectionFunctionAbstract Class](http://php.net/manual/class.reflectionfunctionabstract.php))

#### Example.

[](#example)

```
use Wandu\Reflection\ReflectionCallable;

// 1. string of function's name.
$reflection = new ReflectionCallable('yourfunctionname'); // OK
$reflection = new ReflectionCallable('Your\OwnNamespace\yourfunctionname'); // with namespace also OK.

// 2. string of class and static method's name.
$reflection = new ReflectionCallable('Your\OwnNamespace\MyClass::callMyMethod'); // OK

// 3. array of class and static method's name.
$reflection = new ReflectionCallable(['Your\OwnNamespace\MyClass', 'callMyMethod']); // OK

// 4. array of object and method's name.
$reflection = new ReflectionCallable([new Your\OwnNamespace\MyClass(), 'callMyMethod']); // OK

// 5. object of class that has `__invoke` method.
$reflection = new ReflectionCallable(new Your\OwnNamespace\ClassWithInvoke()); // OK

// 6. object of `Closure`
$reflection = new ReflectionCallable(function ($param1, $param2) { /* do something */ });

$reflection->getNumberOfParameters(); // return 2

// 7. __call
$reflection = new ReflectionCallable([new Your\OwnNamespace\HasCallClass, 'anything']);

$reflection->getNumberOfParameters(); // always return 0
$reflection->getNumberOfRequiredParameters(); // always return 0
$reflection->getParameters(); // always return []
$reflection->getShortName(); // return 'anything'
$reflection->getName(); // return 'anything'

// 8. __callStatic
$reflection = new ReflectionCallable([Your\OwnNamespace\HasCallStaticClass::class, 'anything']);

$reflection->getNumberOfParameters(); // always return 0
$reflection->getNumberOfRequiredParameters(); // always return 0
$reflection->getParameters(); // always return []
$reflection->getShortName(); // return 'anything'
$reflection->getName(); // return 'anything'
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~209 days

Total

4

Last Release

3319d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b499bc2a487ec730542759876340fb439fe2474ea14f2105ca88f003717d495?d=identicon)[wan2land](/maintainers/wan2land)

---

Top Contributors

[![wan2land](https://avatars.githubusercontent.com/u/4086535?v=4)](https://github.com/wan2land "wan2land (1 commits)")

---

Tags

reflectionwanducallable reflection

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wandu-reflection/health.svg)

```
[![Health](https://phpackages.com/badges/wandu-reflection/health.svg)](https://phpackages.com/packages/wandu-reflection)
```

###  Alternatives

[phpdocumentor/reflection-common

Common reflection classes used by phpdocumentor to reflect the code structure

9.1k706.8M26](/packages/phpdocumentor-reflection-common)[symfony/property-access

Provides functions to read and write from/to an object or array using a simple string notation

2.8k295.3M2.5k](/packages/symfony-property-access)[phpdocumentor/reflection

Reflection library to do Static Analysis for PHP Projects

12521.4M109](/packages/phpdocumentor-reflection)[php-di/phpdoc-reader

PhpDocReader parses @var and @param values in PHP docblocks (supports namespaced class names with the same resolution rules as PHP)

7431.6M55](/packages/php-di-phpdoc-reader)[minime/annotations

The KISS PHP annotations library

229378.6k37](/packages/minime-annotations)[spatie/php-attribute-reader

A clean API for working with PHP attributes

80216.4k11](/packages/spatie-php-attribute-reader)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
