Chapter 1: What is HolyPHP?

Understanding HolyPHP

HolyPHP is a low-level, compiled programming language with the soul of PHP. It combines the familiar, easy-to-learn syntax of PHP with the safety and performance of compiled languages like Rust and C.

Think of it this way: if you know PHP, you'll feel right at home. If you've ever wished PHP was faster, safer, or could compile to a standalone executable, HolyPHP is what you're looking for.

Key Features

๐Ÿ˜ PHP Familiar

Uses $variables, looks like PHP, has 305 compatible built-in functions

โšก Compiled to Native Code

Compiles directly to machine code, no interpreter or VM. Fast like C!

๐Ÿ”’ Memory Safe

Compile-time borrow checker prevents memory errors, use-after-free, and data races

๐Ÿ“ฆ Standalone Executables

One command produces a single .exe with everything bundled

๐ŸŽฏ Ownership & Borrowing

Rust-inspired memory model without garbage collection

๐Ÿ› ๏ธ Batteries Included

Built-in GUI, HTML/CSS engine, threading, async, WebSocket libraries

How Does It Work?

HolyPHP goes through a complete compilation pipeline:

source .hphp โ†’ lexer โ†’ parser โ†’ type & borrow checker โ†’ native binary

The entire toolchain is one self-contained hphp binary. It embeds its own runtime and libraries, so you don't need to install dependencies. When you compile, you get a native executable that runs anywhere (on the same platform) with no runtime required.

HolyPHP vs PHP

FeaturePHPHolyPHP
ExecutionInterpreted by Zend EngineCompiled to native machine code
PerformanceSlower~25x faster than PHP 8 (in benchmarks)
Memory SafetyRuntime errors possibleCompile-time borrow checker
DistributionNeeds PHP runtime installedSingle standalone executable
Type SystemDynamic, optional typesDynamic by default, strong when typed + ownership
ConcurrencyLimitedReal OS threads with channels
GUINot built-inNative Win32 GUI library included

HolyPHP vs Rust

FeatureRustHolyPHP
Learning CurveSteepEasier if you know PHP
SyntaxUnique, heavy on keywordsPHP-style, familiar
OwnershipStrict, everywhereRust-inspired but PHP-friendly
Macros/TemplatesComplexSimpler
Time to "Hello World"Longer setupImmediate

When Should You Use HolyPHP?

Key Concept: HolyPHP gives you the best of both worlds - the productivity of PHP with the performance and safety of compiled languages.
Try it yourselfExplain the toolchain. In your own words, write down what each stage does: source file, compiler checks, native program. Name one kind of program you might build.
Show a hint

Take one small step at a time. Follow the instructions above, write down the result you expect, and compare it with what your terminal or Playground shows. If a command fails, check the filename and that you opened a new terminal after installation.