1. Go to this page and download the library: Download knj/revelation 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/ */
knj / revelation example snippets
use function Wazly\Revelation\reveal;
$obj = new class {
private function do() {
return 'You called private method successfully!';
}
};
echo reveal($obj)->do();
class Stuff
{
private $privateProperty;
public function __construct($a, $b)
{
$this->privateProperty = $a + $b;
}
private function privateMethod($x, $y)
{
$this->privateProperty = $x + $y;
return $this;
}
}
use function Wazly\Revelation\reveal;
$stuff = new Stuff(1, 2);
$stuff = reveal($stuff); // now $stuff is a Revelation object
echo $stuff->privateProperty; // 3
$stuff->privateMethod(1, 100);
echo $stuff->privateProperty; // 101
// use function Wazly\Revelation\reveal;
reveal($stuff);
reveal(Stuff::class, 1, 2);
reveal(function ($a, $b) { return new Stuff($a, $b); }, 1, 2);
// use Wazly\Revelation;
Revelation::wrap($stuff);
Revelation::wrap(Stuff::class, 1, 2);
Revelation::wrap(function ($a, $b) { return new Stuff($a, $b); }, 1, 2);