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許可證的條款,該圖書館可作為開源。