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
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.
Feels like PHP
$variables, echo, foreach, arrays with string keys, string interpolation, optional types. No let, no fuss.
🛡Safe like Rust
Borrow checker at compile time, own<T> moves, Rc<T> shared ownership, raw pointers only under unsafe.
🎯Types when you want them
$x = 5 just works. $x: int = 5 pins it down. Function signatures are fully typed.
🖥Native desktop GUI
The ui.hphp standard library builds real windows, buttons, sliders, menus and timers in a few lines.
🌐Browsers included
websocket.hphp speaks RFC 6455: Chrome connects to your HolyPHP server out of the box.
⚡One-file toolchain
The compiler embeds the whole runtime and stdlib. hphp build produces a standalone executable.
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 }
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