PHPackages                             scaleupstack/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. [Caching](/categories/caching)
4. /
5. scaleupstack/reflection

ActiveLibrary[Caching](/categories/caching)

scaleupstack/reflection
=======================

A performance-improved and convenient way to deal with PHP Reflection.

v1.2.1(6y ago)01.5k3BSD-3-ClausePHPPHP &gt;=7.2.0

Since Mar 5Pushed 6y ago1 watchersCompare

[ Source](https://github.com/scaleupstack/reflection)[ Packagist](https://packagist.org/packages/scaleupstack/reflection)[ RSS](/packages/scaleupstack-reflection/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (3)

ScaleUpStack/Reflection
=======================

[](#scaleupstackreflection)

This library provides a performance-improved, and convenient way to deal with PHP Reflection classes.

- **Performance:** Reflection is slow if you instantiate it continuously. If you rely on reflection heavily to inspect the same type of classes in one request over and over again, then caching of the created Reflection classes helps a lot.
- **Convenience:** Instead of dealing with the object graph of Reflection classes, a facade offers convenient methods to

    - retrieve PHP Reflection classes,
    - getting/setting static and non-static properties of an object or class,
    - invoking static and non-static methods of an object or class.

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

[](#installation)

Use [Composer](https://getcomposer.org) to install this library:

```
$ composer require scaleupstack/reflection

```

Usage
-----

[](#usage)

The public API of this package is available via the `ScaleUpStack\Reflection\Reflection` class. All methods of the `Reflection` class are static. (In fact, it is not possible to instantiate it.)

- Namespace

    ```
    use ScaleUpStack\Reflection\Reflection;
    ```
- Methods to retrieve PHP Reflection objects via class name or object:

    ```
    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[]
    ```

    Please note that `classByObject()` returns a `\ReflectionClass` and not a `\ReflectionObject`.
- Methods to access static and non-static properties:

    ```
    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
    ```
- Methods to invoke static and non-static methods:

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

Current State
-------------

[](#current-state)

This library is stable.

Handling of some Reflection features that could (perhaps?) benefit from caching (e.g. getting the parent class) are not implemented yet. But I do not strive for completeness. If you are missing some features, just create a pull request or ask for it, explaining your context/needs.

Contribute
----------

[](#contribute)

Thanks that you want to contribute to ScaleUpStack/Reflection.

- Report any bugs or issues on the [issue tracker](https://github.com/scaleupstack/reflection/issues).
- Get the source code from the [Git repository](https://github.com/scaleupstack/reflection).

License
-------

[](#license)

Please check [LICENSE.md](LICENSE.md) in the root dir of this package.

Copyright
---------

[](#copyright)

ScaleUpVentures Gmbh, Germany
Thomas Nunninger
[www.scaleupventures.com](https://www.scaleupventures.com/)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

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 ~45 days

Total

5

Last Release

2495d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/691747f4cbd1862bd8f73353b9958caff9afc5fa6d2ee3a3c9f411d822cee77d?d=identicon)[ScaleUpStack](/maintainers/ScaleUpStack)

---

Top Contributors

[![ThomasNunninger](https://avatars.githubusercontent.com/u/280145?v=4)](https://github.com/ThomasNunninger "ThomasNunninger (30 commits)")

---

Tags

cachecachingperformancephpphp-reflectionphp7reflectionperformancereflectioncachecaching

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psr/simple-cache

Common interfaces for simple caching

8.1k772.9M2.7k](/packages/psr-simple-cache)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k9.0M69](/packages/spatie-laravel-responsecache)[react/cache

Async, Promise-based cache interface for ReactPHP

445131.2M46](/packages/react-cache)[putyourlightson/craft-blitz

Intelligent static page caching for creating lightning-fast sites.

155484.7k37](/packages/putyourlightson-craft-blitz)[silverstripe/staticpublishqueue

Static publishing queue to create static versions of pages for enhanced performance and security

44140.1k6](/packages/silverstripe-staticpublishqueue)[maartenstaa/laravel-41-route-caching

This package allows you to cache your routes definitions, thereby speeding up each request.

25381.4k](/packages/maartenstaa-laravel-41-route-caching)

PHPackages © 2026

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