PHP code example of ali-eltaweel / computed-properties
1. Go to this page and download the library: Download ali-eltaweel/computed-properties library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ali-eltaweel / computed-properties example snippets
use Lang\{ Annotations\Computes, ComputedProperties };
class User {
use ComputedProperties;
#[Computes('fullName')]
public function getFullName(): string {
return $this->firstName . ' ' . $this->lastName;
}
}
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);
}
}