Download the PHP package kariricode/property-inspector without Composer
On this page you can find all versions of the php package kariricode/property-inspector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kariricode/property-inspector
More information about kariricode/property-inspector
Files in kariricode/property-inspector
Package property-inspector
Short Description Attribute-based property analysis and inspection for the KaririCode Framework, enabling dynamic validation, normalization, and processing of object properties via PHP 8.4+ attributes and reflection.
License MIT
Homepage https://kariricode.org
Informations about the package property-inspector
KaririCode PropertyInspector
The Problem
PHP reflection is boilerplate-heavy, error-prone, and slow when repeated across object graphs:
No caching, no mutation abstraction, no error isolation, no handler contract — just raw loops you repeat in every project.
The Solution
Requirements
| Requirement | Version |
|---|---|
| PHP | 8.4 or higher |
| kariricode/contract | ^2.8 |
| kariricode/exception | ^1.2 |
Installation
Quick Start
Define an attribute, an entity, a handler — and inspect:
Features
Reflection Caching
AttributeAnalyzer caches reflection metadata after the first analysis per class. Subsequent calls for the same class — even with different object instances — skip ReflectionClass entirely:
Multi-Pass Inspection
Run multiple independent passes over the same object with different attribute types:
PropertyAccessor — Safe Property Mutation
Read and write any property (public, protected, private) without setAccessible boilerplate:
Attribute Polymorphism
AttributeAnalyzer uses ReflectionAttribute::IS_INSTANCEOF — it matches attribute hierarchies, not just exact class names:
Isolated Error Handling
All exceptions from reflection or handler code are wrapped in PropertyInspectionException — your calling code only needs to catch one type:
The Inspection Pipeline
Architecture
Source layout
Key design decisions
| Decision | Rationale | ADR |
|---|---|---|
| Reflection cache per class | One ReflectionClass call per type, not per instance |
— |
Remove setAccessible |
Deprecated in PHP 8.1, removed in PHP 9; PropertyAccessor handles this |
ADR-001 |
clearCache() on interface |
Enables test isolation and dynamic class reloading | ADR-002 |
| Wrapped exception hierarchy | Callers catch PropertyInspectionException, not reflection internals |
ADR-003 |
| Handler-returned values | Handler decides the processed value — supports chaining and transformation | — |
Specifications
| Spec | Covers |
|---|---|
| SPEC-001 | Full pipeline: analysis → handler → mutation |
Integration with the KaririCode Ecosystem
PropertyInspector is the reflection engine used internally by other KaririCode components:
| Component | Role |
|---|---|
kariricode/validator |
Uses PropertyInspector to discover #[Rule] attributes and dispatch to rule processors |
kariricode/sanitizer |
Uses PropertyInspector to discover #[Sanitize] attributes and apply transformers |
kariricode/normalizer |
Uses PropertyInspector for attribute-driven normalization passes |
Any component that needs declarative, attribute-based property processing can be built on top of this pipeline.
Project Stats
| Metric | Value |
|---|---|
| PHP source files | 7 |
| External runtime dependencies | 2 (contract · exception) |
| Test suite | 40 tests · 96 assertions |
| PHPStan level | 9 |
| PHP version | 8.4+ |
| ARFA compliance | 1.3 |
| Test suites | Unit + Integration |
| Reflection cache | Per-class, per-AttributeAnalyzer instance |
Contributing
License
Walmir Silva