1. Go to this page and download the library: Download khalyomede/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/ */
khalyomede / expose example snippets
$collection = new Collection(['Dreamer', 'Thunderbird', 'Eclipse']);
$items = $collection->all();
class Collection {
protected $items;
public function __construct($items) {
$this->items = $items;
}
public function all() {
return $this->items;
}
}
class Log {
protected $message;
public function __construct($message) {
$this->message = $message;
}
public function error() {
echo sprintf('Error: %s', $this->message) . PHP_EOL;
}
}
use Khalyomede\Expose;
Expose::make('Collection', 'collection');
// or
Expose::make(Collection::class, 'collection');
$items = collection(['Thunderbird', 'Polaris', 'Eclipse'])->all();
print_($items);
use Khalyomede\Expose;
Expose::make([
[Collection::class, 'collector'],
[Log::class, 'logging'] // beware of existing functions!
]);
$items = collector(['Thunderbird', 'Polaris', 'Eclipse'])->all();
print_r($items);
logging("duplicate entry 'Dreamer' on line 9")->error();
public static function make(string $class_name, string $function_name): void
public static function make(array $exposures): void
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.