ali-eltaweel / computed-properties
There is no license information available for the latest version (1.0.1) of this package.
A PHP library for computed properties.
Package info
github.com/ali-eltaweel/computed-properties
pkg:composer/ali-eltaweel/computed-properties
1.0.1
2025-06-20 17:10 UTC
Requires
- php: ^8.1
- ali-eltaweel/attr-action: ^1.0.0
This package is auto-updated.
Last update: 2026-02-20 18:35:27 UTC
README
Installation
Install computed-properties via Composer:
composer require ali-eltaweel/computed-properties
Usage
Declaring Computed Properties
use Lang\{ Annotations\Computes, ComputedProperties }; class User { use ComputedProperties; #[Computes('fullName')] public function getFullName(): string { return $this->firstName . ' ' . $this->lastName; } }
Dynamic Properties
use Lang\{ Annotations\Computes, ComputedProperties }; class Config { use ComputedProperties; private array $config; #[Computes(provider: 'getConfigKeys')] public function getConfigValue(string $key) { return $this->config[$key]; } function getConfigKeys(): array { return array_keys($this->config); } }