HolyPHP

A compiled, memory-safe programming language with the soul of PHP and the discipline of Rust. Write scripts like it's Friday afternoon — ship binaries like it's C.

hphp run hello.hphp
235+built-in functions (PHP-compatible)
~25×faster than PHP 8 (fib benchmark)
0GC pauses — refcounted, deterministic
1standalone .exe per program, no runtime needed

Why HolyPHP

HolyPHP compiles .hphp source to native machine code through its own C backend. It keeps everything you love about writing PHP — dollar-sign variables, loose typing when you want it, 235 built-in functions, arrays that just work — and adds what PHP never gave you: a compile-time borrow checker, ownership (own<T>), and raw pointers only inside unsafe.

Hello, HolyPHP

// hello.hphp — no imports, no main, just start writing
$name = "Elias";
echo "Hello, {$name}!\n";

// optional types, like Rust — but only when you ask
function fib(int $n): int {
    if ($n < 2) { return $n; }
    return fib($n - 1) + fib($n - 2);
}
echo "fib(10) = " . fib(10) . "\n";

A real GUI in 12 lines

import "ui.hphp";

$app = new App("My App", 640, 420);
$btn = $app->button("Click me", 16, 40);
$name = $app->input("world", 16, 80);

$btn->onClick = function() use ($app, $name) {
    $app->msg("Hello, " . $name->value() . "!");
};

$app->run();   // real desktop event loop

The memory model, in one look

// borrows are checked at compile time — like Rust
function bump(int &$r): void { $r += 1; }   // &mut borrow

$n = 41;
bump($n);          // $n is now 42

// raw pointers exist only under unsafe
unsafe {
    $x = 42;
    $p = &$x;
    echo "deref: " . (*$p) . "\n";
}

// ownership is explicit
enum Farbe: int { Rot, Gruen, Blau }
Note: the borrow checker runs at compile time (hphp check) — many immutable borrows xor exactly one mutable borrow, use-after-move is rejected, and there is nothing to debug at 3 AM because there is no data race to have.

Get it

Build the toolchain from source (Windows today, macOS/Linux ports welcome):

bash scripts/build.sh     # produces ./hphp.exe with runtime embedded

hphp check program.hphp   # type + borrow check only
hphp run program.hphp     # compile & execute
hphp build program.hphp -o app.exe   # standalone binary