1. Go to this page and download the library: Download betterde/voyager 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/ */
betterde / voyager example snippets
use Betterde\Voyager\Debug;
ng
{
return "Hello, {$name}!";
}
echo greet('World'); // Hello, World!
Debug::functionRedefine('greet', function (string $name): string {
return "Hi, {$name}! This function was redefined.";
});
echo greet('World'); // Hi, World! This function was redefined.
use Betterde\Voyager\Debug;
class Counter
{
public int $value = 0;
public function increment(): int
{
return ++$this->value;
}
}
$counter = new Counter();
Debug::methodRedefine(Counter::class, 'increment', function (): int {
$this->value += 10;
return $this->value;
});
echo $counter->increment(); // 10
echo $counter->increment(); // 20