Download the PHP package ucscode/object-reflector without Composer
On this page you can find all versions of the php package ucscode/object-reflector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ucscode/object-reflector
More information about ucscode/object-reflector
Files in ucscode/object-reflector
Package object-reflector
Short Description A reflector that provides access to class encapsulated properties or methods
License MIT
Informations about the package object-reflector
ObjectReflector v2.0
Surgical precision for PHP object manipulation.
ObjectReflector is a lightweight, fluent utility designed to bypass PHP encapsulation. It provides a clean API to interact with private and protected properties or methods without the boilerplate of the native Reflection API.
Optimized for PHP 8.1+ (No setAccessible() required).
🚀 Features
- Fluent Interface: Chain multiple
set()andcall()operations in a single line. - Recursive Reflection: Use
reflect()to dive into nested object properties instantly. - Modern PHP: Built to leverage PHP 8.1+ universal reflection access.
- Zero Boilerplate: No more
ReflectionClassorReflectionMethodmanual instantiation.
🛠 Installation
📖 Usage
1. Basic Manipulation (Fluent)
Reach into any object and modify its state, regardless of visibility.
2. Recursive Reflection
If a property contains another object, you can chain reflectors to access the child's internals without creating new variables.
3. Dynamic Invocation
Invoke methods using variadic arguments or arrays—perfect for hydrating objects from API payloads.
🎯 Why Use This?
- Testing: Access private state in unit tests without adding public getters.
- Hydration: Map database or API results to strictly encapsulated Domain Entities.
- Legacy Support: Manipulate objects in third-party libraries that didn't provide enough hooks.
⚖️ License
The MIT License (MIT). Please see License File for more information.