ali-eltaweel / virtual-props
There is no license information available for the latest version (1.0.0) of this package.
Virtual properties setters
1.0.0
2025-06-20 11:48 UTC
Requires
- php: ^8.1
- ali-eltaweel/attr-action: ^1.0.0
This package is auto-updated.
Last update: 2025-06-20 11:53:34 UTC
README
Installation
Install virtual-props via Composer:
composer require ali-eltaweel/virtual-props
Usage
Declaring Virtual Properties
use Lang\{ Annotations\Sets, VirtualProperties }; class X { use VirtualProperties; private array $data = []; #[Sets('x')] private function setX(int $value) { $this->data['x'] = $value; } #[Sets('y')] private function setY(int $value) { $this->data['y'] = $value; } #[Sets('i', 'j')] private function setProp(int $value, string $name) { $this->data[$name] = $value; } }
$x = new X(); $x->x = 10; $x->y = 20; $x->i = 30; $x->j = 40;