1. Go to this page and download the library: Download stevenwadejr/exposure 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/ */
stevenwadejr / exposure example snippets
use StevenWadeJr\Exposure\Factory;
class CantTouchThis
{
private $privateParty = 'This is private';
}
$exposed = Factory::expose(new CantTouchThis);
use StevenWadeJr\Exposure\Exposure;
class CantTouchThis
{
public $publicProperty = 'This is public';
protected $protectedProperty = 'This is protected';
private $privateProperty = 'This is private';
public function publicMethod()
{
return 'This is a public method';
}
protected function protectedMethod()
{
return 'This is a protected method';
}
private function privateMethod()
{
return 'This is a private method';
}
}
$exposure = new Exposure(new CantTouchThis);
echo $exposure->publicProperty; // outputs 'This is public'
echo $exposure->publicMethod(); // outputs 'This is a public method'
echo $exposure->privateProperty; // outputs 'This is private'
echo $exposure->protectedMethod(); // outputs 'This is a protected method'