PHP code example of shasoft / reflection
1. Go to this page and download the library: Download shasoft/reflection 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/ */
shasoft / reflection example snippets
class MyObject{
function __construct(private int $prop) {
}
}
$obj = new MyObject(123);
// Создать прокси объект
$proxyObj = new FriendProxy($obj);
// Вывести приватное свойство
echo $proxyObj->prop;
class TestClass1
{
}
class TestClass2
{
public static function print() : void {
$items = Items::list(__FILE__);
var_dump($items);
}
}
TestClass2::print();
[
'TestClass1',
'TestClass2',
]