Implementation of Symfony's PropertyAccessorInterface
that reads and writes
directly to the object's properties, bypassing getters and setters.
use Rekalogika\DirectPropertyAccess\DirectPropertyAccessor;
class Person
{
private string $name = 'Jane';
}
$propertyAccessor = new DirectPropertyAccessor();
$name = $propertyAccessor->getValue($person, 'name'); // Jane
$propertyAccessor->setValue($person, 'name', 'John');
rekalogika.dev/direct-property-access
This project took inspiration from the following projects.
MIT
Issues and pull requests should be filed in the GitHub repository rekalogika/direct-property-access.