php private access
3.0.0
一个小型简单库,可访问对象的私人属性。实际上,这是Mad Skillz的一个例子,而不是有用的工具。没有反射API电话!
使用作曲家:
composer require arokettu/private-access --dev
这四个简单的功能可以作为psysh之类的助手派上用场
get_private_field()set_private_field()call_private_method()get_private_const() <?php
class X {
private $ field = 123 ;
}
$ x = new X ();
var_dump ( Arokettu Debug get_private_field ( $ x , ' field ' )); // 123
Arokettu Debug set_private_field ( $ x , ' field ' , 321 ); // $x->field = 321; 在此处阅读完整文档:https://sandfox.dev/php/private-access.html
还可以阅读文档:https://php-private-access.readthedocs.io/
请在我们的主要存储库上提交问题:https://gitlab.com/sandfox/php-private-access/-/issues
根据MIT许可证的条款,该图书馆可作为开源。