PHP code example of suin / php-expose
1. Go to this page and download the library: Download suin/php-expose 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/ */
suin / php-expose example snippets
use \Expose\Expose as e;
class Object
{
private $_secret;
protected $_protected;
private function _hello($world = 'World')
{
return sprintf('Hello, %s', $world);
}
}
$object = new Object();
// Expose non-public properties
e::expose($object)
->attr('_secret', 'foo')
->attr('_protected', 'bar');
// Call non-public method
$result = e::expose($object)->call('_hello', 'Suin');