PHPackages                             nsp-team/reflection-tool - 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. nsp-team/reflection-tool

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

nsp-team/reflection-tool
========================

允许直接访问受保护/私有属性并调用受保护/私有方法

1.0.0(4y ago)141Apache-2.0PHPPHP &gt;=7.3.0

Since Nov 4Pushed 4y agoCompare

[ Source](https://github.com/nsp-team/reflection-tool)[ Packagist](https://packagist.org/packages/nsp-team/reflection-tool)[ RSS](/packages/nsp-team-reflection-tool/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/76f1458dc52a4d56f17c6d3d8de972145bc810c1fb1360b4c3b723786d49f68b/687474703a2f2f706f7365722e707567782e6f72672f6e73702d7465616d2f7265666c656374696f6e2d746f6f6c2f76)](https://packagist.org/packages/nsp-team/reflection-tool) [![Total Downloads](https://camo.githubusercontent.com/8f0a4952be3e614b9534230a84d68bb901bbeb35193ecb598cf91c9f2b0d7f63/687474703a2f2f706f7365722e707567782e6f72672f6e73702d7465616d2f7265666c656374696f6e2d746f6f6c2f646f776e6c6f616473)](https://packagist.org/packages/nsp-team/reflection-tool) [![Latest Unstable Version](https://camo.githubusercontent.com/29af9408cf35df30503105f794e24669e335a0a263279b4e3162f790268a7f79/687474703a2f2f706f7365722e707567782e6f72672f6e73702d7465616d2f7265666c656374696f6e2d746f6f6c2f762f756e737461626c65)](https://packagist.org/packages/nsp-team/reflection-tool) [![License](https://camo.githubusercontent.com/c4dadb57d0e5f34ec25f41b661645a3ed211902465b0b7f1f0254e699e3ae6d2/687474703a2f2f706f7365722e707567782e6f72672f6e73702d7465616d2f7265666c656374696f6e2d746f6f6c2f6c6963656e7365)](https://packagist.org/packages/nsp-team/reflection-tool) [![PHP Version Require](https://camo.githubusercontent.com/2a55a03ce219980c7934be6420e9093b186d4de2a7a5d7fb4b13aee1ff738180/687474703a2f2f706f7365722e707567782e6f72672f6e73702d7465616d2f7265666c656374696f6e2d746f6f6c2f726571756972652f706870)](https://packagist.org/packages/nsp-team/reflection-tool)

A PHP reflection library to directly access protected/private properties and call protected/private methods.

This library works with major versions of PHP 7.3.

Installation
============

[](#installation)

```
composer require nsp-team/reflection-tool:~1.0.0
```

Sample Usage
============

[](#sample-usage)

```
require __DIR__ . '/vendor/autoload.php';

use NspTeam\Reflection\ReflectionObject;

class Test
{
    private $key;
    private static $keyStatic;

    /**
     *
     * @return string
     */
    private function one(): string
    {
        return '私有方法';
    }

    /**
     * @param int $i
     * @param int $j
     * @return string
     */
    private static function oneStatic(int $i, int $j): string
    {
        return "私有静态方法 带参 $i 和 $j";
    }
}

$test = new Test();

ReflectionObject::setProperty(Test::class, 'keyStatic', 'another value');
ReflectionObject::setProperty($test, 'key', 'value ');

var_dump(ReflectionObject::callMethod($test, 'one'));
var_dump(ReflectionObject::getProperty($test, 'key'));

var_dump(ReflectionObject::callMethod($test, 'oneStatic', array(1, 2)));
var_dump(ReflectionObject::getProperty($test, 'keyStatic'));

var_dump(ReflectionObject::findProperty($test, 'key'));
var_dump(ReflectionObject::getMethod(Test::class, 'one')->getDocComment());
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

Unknown

Total

1

Last Release

1655d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b9755903f7a6e3183dc76df22ec6c1db85fc54724e85c6e4351efbfd563bc07a?d=identicon)[19951591761](/maintainers/19951591761)

---

Top Contributors

[![Maoxp](https://avatars.githubusercontent.com/u/37761489?v=4)](https://github.com/Maoxp "Maoxp (6 commits)")

---

Tags

reflectionwebman

### Embed Badge

![Health badge](/badges/nsp-team-reflection-tool/health.svg)

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

###  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)
