Lyger Framework v0.2
A PHP 8.3+ framework with a Rust FFI backend, an explicit PHP fallback, and reproducible validation notes.
v0.1 is frozen. v0.2 is the validated release line; its Rust queue transport, database contracts and bounded result streaming have reproducible acceptance tests.
Why Lyger?
Lyger is designed for teams that want a persistent PHP worker with a native Rust boundary for HTTP and database I/O, while retaining familiar PHP routing, validation and ORM patterns. v0.2 makes that architecture measurable through ABI, database, HTTP, memory and streaming contracts.
v0.3 roadmap: PardoX analytics
The next major line will investigate an official Lyger–PardoX integration for large-scale analytics through PHP. The integration is planned, not shipped in v0.2; its implementation will require a stable binding contract, bounded data exchange and reproducible benchmarks.
What is Lyger?
Lyger is a next-generation PHP framework that fundamentally changes how PHP handles web requests. Instead of the traditional PHP-FPM model — where PHP boots from scratch on every request — Lyger keeps its worker always alive in memory, delegating raw HTTP handling to a Rust-powered Axum server via a zero-copy FFI bridge.
The result is PHP with the speed of a compiled language.
Core Principles
| Principle | Description |
|---|---|
| Always-Alive | Rust keeps the HTTP transport alive while PHP handles requests on its main thread |
| Bounded streaming | Large result sets are consumed in ordered chunks with an explicit memory budget |
| Zero-Copy FFI | Data stays in Rust-owned result handles until the final JSON ABI boundary |
| Zero-Bloat | An interactive installer physically removes unused code after project setup |
| Familiar DX | Eloquent-style ORM, Route facades, Eloquent-style validation — Laravel patterns, Rust performance |
Performance At a Glance
| Operation | Lyger | Laravel | Symfony |
|---|---|---|---|
| SQLite FFI query + JSON (single call) | 1.68 ms | — | — |
| Heavy computation (10M iterations) | 73 ms | 368 ms | — |
| JSON serialization | estimated only* | — | — |
| Memory sample | 16 MB used / 18 MB peak | — | — |
* The current JSON Rust value is calculated by the legacy benchmark and is not a direct Rust timing. Full methodology and results: Performance.
Requirements
- PHP 8.3 or higher
- PHP
ffiextension enabled (ffi.enable = 1) - Composer
- Rust toolchain (for compiling the FFI library)
Quick Install
git clone https://github.com/betoalien/Lyger-PHP-Framework.git my-project
cd my-project
composer install
php rawr install # Interactive zero-bloat setup
php rawr serve # Start the Always-Alive server
See the full Getting Started guide for step-by-step instructions.
Documentation Overview
| Section | Description |
|---|---|
| Getting Started | Installation, project setup, first routes |
| Architecture | Always-Alive + Zero-Copy deep dive |
| Routing | Route definitions, parameters, groups |
| Requests | Capturing and reading HTTP input |
| Responses | Sending JSON, HTML, and custom responses |
| ORM | Models, relationships, collections |
| Query Builder | Fluent SQL query builder |
| Schema & Migrations | Table creation and migration system |
| Validation | Request validation with 20+ rules |
| Cache | In-memory caching with TTL |
| Events | Event dispatching and broadcasting |
| Jobs & Queues | Async job queue with persistence |
| API Resources | JSON API responses and resources |
| Middleware | Request/response pipeline |
| Container | Dependency injection |
| Helpers | Env, Path, Str, Arr, Config, Platform |
| Testing | Test case classes and assertions |
| CLI Reference | All rawr commands |
| Rust FFI | The Rust backend and FFI API |
| Performance | Benchmarks and analysis |