1. Go to this page and download the library: Download xp-framework/compiler 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/ */
xp-framework / compiler example snippets
// In a file "HelloWorld.php"
use lang\Reflection;
use util\Date;
use util\cmd\Console;
#[Author('Timm Friebe')]
#[Permissions(0o777)]
class HelloWorld {
private const string GREETING= 'Hello';
public static function main(array<string> $args): void {
$greet= fn($to, $from) => self::GREETING.' '.$to.' from '.$from;
$author= Reflection::type(self::class)->annotation(Author::class)->argument(0);
Console::writeLine(new Date()->toString(), ': ', $greet($args[0] ?? 'World', from: $author));
}
}