PHPackages                             hudsxn/introspection - 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. hudsxn/introspection

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

hudsxn/introspection
====================

Rapid Reflection utility with extra ergonomic functions

v1.0.1(4mo ago)05MITPHP

Since Jan 4Pushed 4mo agoCompare

[ Source](https://github.com/hudsxncom/introspection)[ Packagist](https://packagist.org/packages/hudsxn/introspection)[ RSS](/packages/hudsxn-introspection/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Hudsxn Introspection
====================

[](#hudsxn-introspection)

Hudsxn Introspection is a **high-performance PHP library** for full-depth class, interface, and trait introspection. It captures **properties, constants, methods, method arguments, and attributes** while supporting **memory caching**, **filesystem-backed caching**, and selective or full refresh modes. Ideal for frameworks, static analysis tools, IDE integrations, and any system that requires reliable reflection metadata.

---

Features
--------

[](#features)

- Deep introspection of **classes, interfaces, and traits**
- **Memory caching** for repeated accesses
- **Filesystem caching** to persist introspection results across requests
- **Refresh mode** to regenerate metadata when source changes
- **Selective refresh** to optimize performance in large systems
- Singleton-based introspector for centralized caching and consistent results
- Fully **tested** and production-ready

---

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

[](#installation)

Install via Composer:

```
composer require hudsxn/introspection
```

---

Basic Usage
-----------

[](#basic-usage)

```
use Hudsxn\Introspection\Introspector;

// Get singleton instance
$introspector = Introspector::getSelf();

// Initialize with cache directory
$introspector->init(__DIR__ . '/cache');

// Set mode (fastest in-memory caching)
$introspector->setMode(Introspector::MODE_FASTEST);

// Introspect a class
$classObj = $introspector->getClass(MyApp\ExampleClass::class);

// Access properties
foreach ($classObj->getProperties() as $property) {
    echo $property->getName() . ': ' . $property->getType() . PHP_EOL;
}

// Access methods and arguments
foreach ($classObj->getMethods() as $method) {
    echo $method->getName() . '(): ' . $method->getReturnType() . PHP_EOL;
    foreach ($method->getArguments() as $arg) {
        echo '  - ' . $arg->getName() . ': ' . $arg->getType() . PHP_EOL;
    }
}
```

---

Refresh Modes
-------------

[](#refresh-modes)

- **Default:** Uses memory and filesystem caches
- **Refresh:** Regenerates class metadata from source
- **Selective Refresh:** Only refresh specific classes

```
// Refresh a single class
$introspector->setMode([\MyApp\ExampleClass::class]);
$refreshedClass = $introspector->getClass(MyApp\ExampleClass::class);
```

---

Filesystem Cache
----------------

[](#filesystem-cache)

- The library can **persist introspected metadata to disk** for faster repeated access.
- Clearing memory cache does **not remove filesystem cache**, so subsequent requests will load cached PHP files.

```
// Clear only memory cache
$introspector->clearInstanceCache();

// Clear memory + filesystem cache
$introspector->clearCache();
```

---

Performance Benefits
--------------------

[](#performance-benefits)

OperationWithout CacheWith Memory CacheWith Filesystem CacheFirst introspection100% parsing overheadN/AN/ASecond introspection100% parsingNear-instantNear-instantSubsequent request after memory clear100% parsingN/ANear-instant (loaded from disk)- **Memory cache** ensures repeated accesses are **nearly instantaneous**.
- **Filesystem cache** avoids repeated reflection parsing across processes.
- Works seamlessly for **hundreds of classes** with negligible overhead.

---

---

Testing
-------

[](#testing)

Run full test suite:

```
composer install
vendor/bin/phpunit
```

- The library is fully tested for **memory caching, filesystem caching, refresh modes**, and **deep introspection** of classes, interfaces, and traits.
- Tests validate that cached files maintain **100% fidelity** with native PHP reflection.

---

Contributing
------------

[](#contributing)

Contributions are welcome! Please submit pull requests or open issues on GitHub.

- Follow PSR-12 coding standards
- Include tests for new features or fixes
- Ensure **cache and introspection integrity**

---

License
-------

[](#license)

MIT License – see [LICENSE](LICENSE)

---

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance75

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

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

Total

2

Last Release

134d ago

### Community

Maintainers

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

---

Top Contributors

[![hudson1998x](https://avatars.githubusercontent.com/u/22916228?v=4)](https://github.com/hudson1998x "hudson1998x (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hudsxn-introspection/health.svg)

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

###  Alternatives

[arara/process

Provides a better API to work with processes on Unix-like systems

16861.7k2](/packages/arara-process)[ezsystems/ezautosave-ls

Content editing autosave extension for eZ Publish legacy

22423.2k3](/packages/ezsystems-ezautosave-ls)[copyleaks/php-plagiarism-checker

Copyleaks detects online plagiarism and checks content distribution. Use Copyleaks to find out if textual content is original and where it has been used before. This package shows how to integrate with the Copyleaks cloud to search for copyright infringement.

5066.4k](/packages/copyleaks-php-plagiarism-checker)[teknomavi/tcmb

T.C. Merkez Bankası üzerinden güncel döviz kurlarını çeker

7019.2k](/packages/teknomavi-tcmb)[silverstripe/multiform

SilverStripe forms with multiple steps, flow control and state persistence

3156.0k3](/packages/silverstripe-multiform)[kinglozzer/multiselectfield

A sortable multiple select field for managing many-to-many relations

1341.2k2](/packages/kinglozzer-multiselectfield)

PHPackages © 2026

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