RHP v0.1.0-alpha Released·Read docs

A Rust-Powered,
PHP-Family Language
for Fast Web Backends

Supercharge Laravel-style apps with the raw speed, memory safety, and zero-GC predictability of Rust. Eliminate per-request bootstrapping without complex workarounds.

$brew install vuenice/rhp/rhp

Or via Cargo: cargo install rhp

server.rhp
RHP 0.1
// 1. Native Rust-backed collection pipeline
list $orders = Arr::list([120, 45, 890, 15, 330])
    ->filter(fn($price) => $price > 50)
    ->map(fn($price) => $price * 1.08);

// 2. Non-blocking Tokio fiber concurrency
[$user, $metrics] = Future::wait([
    fn() => DB::table('users')->find(42),
    fn() => HTTP::get('https://api.internal/metrics')->json()
]);

// 3. Post-response cleanup hook
Future::defer(fn() => Log::info("Served user #{$user->id}"));

// 4. Instant verification: zero GC pauses
Sys::print("Peak memory: " . Memory::peak() . " bytes");
rhp run dev • 0.4ms startupGC Pause: 0.0ms
Engine Fundamentals

Why RHP? Built from the ground up in Rust

Solve the core scalability and architectural limits of traditional dynamic runtimes without sacrificing developer velocity.

Persistent Parent Architecture

0ms Per-Request Re-parse

Eliminates PHP-FPM's per-request bootstrap overhead. Your application code, routing, and framework state are compiled once into immutable Arc<EngineState>.

// Bootstrapped once in Parent Process
singleton class AppEngine {
    public static function boot(): void {
        DB::pool(min: 10, max: 100);
    }
}

Native Rust Collection Subtypes

Cache-Friendly Heap

Standard arrays map directly to high-performance Rust heap structures with Copy-On-Write (COW) semantics and CPU cache locality.

// Explicit Rust collection subtypes
list $nums = Arr::list([1, 2, 3]);
dict $user = Arr::dict(['name' => 'Alice']);
set  $tags = Arr::set(['fast', 'rust']);

Tokio Async Concurrency & Fibers

Tokio Thread Pool

Synchronous by default on local fibers, but non-blocking when needed. Run background tasks or parallel queries with Dart-inspired Futures.

// Parallel queries evaluated cleanly
[$orders, $stats] = Future::wait([
    fn() => DB::table('orders')->recent(),
    fn() => HTTP::get('https://analytics')->json()
]);

Dual-Engine Execution Strategy

Dev & Prod Engines

Tree-walking AST interpreter for sub-millisecond dev cold starts and hot-reload. Lowers to Register Bytecode VM with Cranelift JIT in production.

// Development (picks index.rhp in pwd)
rhp run dev

// Production (specify target via --file)
rhp run build --file="/your-path/server.rhp"

Zero-GC Deterministic RAII

0.0ms GC Pause Time

No stop-the-world garbage collection sweeps or pause times. Request memory is deallocated in O(1) time via bump arena resets.

// Bump arena reclaimed in O(1)
Memory::scope(function() {
    $temp = File::read('heavy.csv');
    // Drops instantly on return
});
print(Memory::gcPauseMs()); // 0.0

AST-Guided Lint & Auto-Typing

Built-in Toolchain

Integrated toolchain inspired by Mago. Formats code to 4-space standard, automatically infers variable type hints, and normalizes casing.

// Before: $fullName = 'alice';
// After 'rhp run lint':
string $full_name = 'alice';
Syntax & Ergonomics Comparison

The Same Backend Task, Compared

See how RHP balances Laravel's developer velocity with Rust's thread-safe concurrency and memory guarantees.

Task:Concurrent API Fetch + Filter + Post-Response Hook
// RHP: Clean expressive syntax, Tokio non-blocking fibers, zero GC
function getUserDashboard(int $user_id): dict {
    // Run both network & DB queries concurrently without thread locking
    [$profile, $orders] = Future::wait([
        fn() => DB::table('users')->find($user_id),
        fn() => HTTP::get("https://api.orders.internal/{$user_id}")->json()
    ]);

    // Native Rust list filtering & transformation
    list $high_value = Arr::list($orders)->filter(fn($o) => $o['total'] > 100);

    // Post-response hook: flushes to client first, logs in background
    Future::defer(fn() => Log::info("Dashboard rendered for {$user_id}"));

    return Arr::dict(['user' => $profile, 'recent_orders' => $high_value]);
}
RHP Trade-offAlpha status (v0.1.0). Native syntax guarantees, but ecosystem and community packages are actively developing.
Execution ModelTokio worker fiber pool with persistent Arc<EngineState> memory.
Memory LifecycleScoped bump arenas. 0% GC cycles, 0ms pause times, and zero cyclic reference leaks.
Playground App

RHP Playground App

An interactive desktop scratchpad to run RHP scripts instantly and debug Local, Docker, or Remote applications — just like TweakPHP for your PHP & RHP workflows.

Try NowDocumentation
rhp-play • Standalone & App Debugger
Dedicated Guide
RHP Playground desktop app interface showing interactive code execution and application debugging
Read Playground Documentation
Standalone & Multi-Host Execution Ready
GC Pause: 0.0ms•Sub-millisecond JIT Startup

Instant Script Runner

Test RHP syntax, native collection pipelines (`Arr::list`), and Tokio async futures without boilerplate, scaffolding, or server boots.

Local, Docker & Remote SSH

Connect directly to your local projects, Docker containers, or live staging/production servers over SSH to evaluate code in context.

TweakPHP-Style Workflow

Query application databases, call service classes, verify fixes, and inspect output with real-time memory and GC telemetry.

Vision & Progress

Ecosystem & Development Roadmap

Transparent progress from initial language design to register VM execution and enterprise production stability.

Available

Command-Line Toolchain

Single static binary rhp handling direct dev interpretation, production bytecode JIT compilation, and linting.

Available

VS Code & Neovim Extensions

Syntax highlighting grammars, semantic tokens, and Tree-sitter parsers for modern code editors.

In Development

Language Server (LSP)

Real-time diagnostic checks, symbol completion, type inference tooltips, and jump-to-definition.

Preview

Rust FFI & Tier 2 Plugins

Include custom high-speed Rust crates and compile native shared libraries directly into your engine.

Milestone Timeline

v0.1.0 AlphaCurrent Release

Language Foundation & AST Engine

  • ✓Logos zero-copy DFA lexer and Pratt expression parser
  • ✓Tier 1 native facades (Arr, Str, Future, Memory, Sys)
  • ✓Direct AST dev interpreter (<5ms cold start)
  • ✓AST auto-formatter & boundary typing (rhp run lint)
v0.2.0 BetaQ1 2027

Register VM & JIT Pipeline

  • •Compact register-based linear IR bytecode emission
  • •Cranelift JIT hot-path native compilation
  • •Multi-worker Tokio fiber execution pool
  • •Persistent parent process immutable Arc<EngineState>
v0.3.0 PreviewQ2 2027

Package Ecosystem & Composer Bridge

  • •Dedicated RHP package registry and dependency solver
  • •Transparent Composer autoload bridge for legacy vendor packages
  • •Full Debug Adapter Protocol (DAP) server for IDEs
  • •WebAssembly browser-compiler distribution
v1.0.0 ProductionLate 2027

LTS Release & Framework Kernel

  • •Complete Laravel-compatible drop-in HTTP router & ORM
  • •Long-term API stability and strict semver guarantee
  • •Automated migration toolchain from PHP 8.x codebase
  • •Enterprise production benchmarking harness
Quick Start

Up and Running in 30 Seconds

Three simple steps to install the toolchain, write your first script, and run it at sub-millisecond speeds.

1

Install with Homebrew

Install the official standalone RHP binary for macOS or Linux using Homebrew.

$ brew install vuenice/rhp/rhp
2

Write hello.rhp

Write clean PHP-style syntax utilizing Rust-backed static facades like Str and Sys.

string $slug = Str::slug("Hello RHP");
print($slug);
3

Execute with rhp CLI

Run instantly with the AST development interpreter, or compile to bytecode VM via production mode.

# Dev mode (auto-picks index.rhp)
$ rhp run dev
# Or explicit file
$ rhp run dev --file="hello.rhp"