1. Go to this page and download the library: Download c01l/phpdecorator-memo 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/ */
c01l / phpdecorator-memo example snippets
class TestClass
{
#[Memo(["bar"])]
public function foo(int $bar, int $x): int
{
return $x;
}
}
$obj = new TestClass();
$obj = (new \C01l\PhpDecorator\DecoratorManager())->decorate($obj);
$obj->foo(1,2) // 2
$obj->foo(2,3) // 3
$obj->foo(1,3) // 2, because foo is not really executed again, but the cached version is used
#[Memo(["bar", "x"])]
public function foo($bar, $x) { return $x; }
class A {
public int $x, $y, $z;
public function getX() { return $x; }
}
...
#[Memo(["bar->z", "bar->getX()"])]
public function foo(A $bar, $x) { return $x; }
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.