duncan3dc / object-intruder
A small library to access private/protected properties/methods of objects
Installs: 254 717
Dependents: 26
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 3
Open Issues: 1
Requires
- php: ^7.4 || ^8.0
Requires (Dev)
- infection/infection: ^0.20.2
- maglnet/composer-require-checker: ^2.0
- phpstan/phpstan: ^0.12.59
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-12-21 02:15:28 UTC
README
A small PHP library to access private/protected properties/methods of objects
Installation
The recommended method of installing this library is via Composer.
Run the following command from your project root:
$ composer require duncan3dc/object-intruder
Usage
use duncan3dc\ObjectIntruder\Intruder; $table = new Intruder(new Table); $table->secretMethodNotPublic("Hello", "World"); $table->privateStuff = "modified";
Unfortunatly due to a limitation of __call methods with parameters passed by reference are not supported.
However there is a workaround available using the _call()
method:
$stuff = "start"; $table = new Intruder(new Table); $table->_call("secretMethod", $stuff, Table::MODIFY);
Changelog
A Changelog has been available since the beginning of time
Where to get help
Found a bug? Got a question? Just not sure how something works?
Please create an issue and I'll do my best to help out.
Alternatively you can catch me on Twitter