betoalien/lyger

Lyger Framework v0.2 - PHP with the production Rust FFI bridge

Maintainers

Package info

github.com/betoalien/Lyger-PHP-Framework

Type:project

pkg:composer/betoalien/lyger

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 12

Open Issues: 0

dev-main 2026-07-21 19:13 UTC

This package is auto-updated.

Last update: 2026-07-21 19:13:57 UTC


README

⚑ Lyger Framework v0.2

Lyger, the leader in stars.

v0.1 is frozen for historical compatibility. v0.2 is the validated release line for the Rust FFI bridge.

A high-performance PHP 8.3+ framework powered by a Rust FFI backend. Always-Alive workers. Zero-Copy data. Zero-Bloat installation.

PHP 8.3+ Rust License: MIT Version


πŸ“– Documentation Β Β·Β  πŸš€ Quick Start Β Β·Β  πŸ“Š Benchmarks Β Β·Β  🎯 Demo

See CHANGELOG.md for the ordered release history and docs/MIGRATION-v0.1-v0.2.md for upgrade notes.

Why Lyger?

Lyger exists to make a persistent PHP application lifecycle measurable and controllable. Instead of repeatedly booting a conventional framework, Lyger keeps a PHP worker alive while Rust handles native HTTP I/O, database drivers and bounded result storage. This gives applications a clear Rust/PHP boundary without requiring invasive changes to an existing framework.

The goal is not an unqualified performance promise: v0.2 reports reproducible contracts and local measurements, while separating estimates from direct benchmarks. See the validation record.

What makes Lyger different?

Traditional PHP frameworks die and restart on every request. Lyger doesn't.

Laravel / Symfony                    Lyger
─────────────────                    ──────────────────────────────────
Request β†’ Boot PHP    (50-200ms)     Request β†’ Rust HTTP Server (Axum)
        β†’ Load 500+ files                    β†’ PHP Worker (already loaded)
        β†’ Register services                  β†’ Execute logic only
        β†’ Handle request                     β†’ Return response
        β†’ Die
        β†’ Repeat forever

Lyger keeps PHP always alive in memory and routes requests through a native Rust HTTP server. Database queries run through a Zero-Copy FFI bridge β€” results stay in Rust memory, PHP never touches the raw bytes.

Performance

Measurements must be reproducible. Results below are local microbenchmarks, not a universal performance guarantee.

Operation Lyger Laravel Symfony Advantage
SQLite FFI query + JSON (single call) 1.68 ms β€” β€” measured locally
Heavy Computation (10M iter) 73 ms 368 ms β€” 5.1Γ—
JSON Serialization (1 000 objects Γ— 100) 6.86 ms* 20.59 ms β€” 3Γ—*
Hello World in-process loop (1 000 iterations) 0.01 ms β€” β€” not HTTP throughput

* The JSON Rust value is currently a calculated estimate in the legacy benchmark and is not a direct Rust timing. PostgreSQL/MySQL CRUD validation is covered by the Rust-core integration suite; equivalent PHP-driver benchmarks are not yet public claims.

Benchmark methodology and reproduction steps: docs/validation-results.md and benchmark/run.php.

Roadmap: v0.3 and PardoX

v0.3 will investigate an official Lyger–PardoX integration for large-scale data analytics exposed through PHP. This is a roadmap commitment, not a v0.2 feature: the future contract must define stable Rust/PHP/PardoX bindings, bounded data exchange and reproducible analytical benchmarks. See the v0.3 roadmap.

Quick Start

Requirements

  • PHP 8.3+ with ffi extension
  • Composer

Install

Via Composer (recommended):

composer create-project betoalien/lyger my-app
cd my-app

Via Git:

git clone https://github.com/betoalien/Lyger-PHP-Framework.git my-app
cd my-app
composer install

Enable FFI in php.ini:

ffi.enable = 1

Setup (Zero-Bloat installer)

php rawr install

The interactive installer removes every module you don't need β€” leaving only the code your project actually uses.

? Architecture   β†’  API Headless  |  Full-Stack
? Frontend       β†’  Vue.js  |  React  |  Svelte
? Database       β†’  SQLite  |  PostgreSQL  |  MySQL
? Auth           β†’  Session  |  JWT  |  None

Start the server

php rawr serve          # Always-Alive mode (Rust HTTP server)
php rawr serve:php      # PHP built-in server (fallback)

Visit http://localhost:8000

Your first route

// routes/web.php
use Lyger\Routing\Route;
use Lyger\Http\Response;

Route::get('/api/users', function () {
    $users = User::all();
    return Response::json($users->toArray());
});

Route::post('/api/users/{id}', [UserController::class, 'update']);

Core features

Feature Description
Always-Alive Worker PHP stays loaded in memory β€” zero restart overhead per request
Rust FFI Bridge Native Rust library for HTTP, DB, cache, and computation
Zero-Copy Database Query results live in Rust memory; PHP holds an opaque pointer
Eloquent-style ORM find(), all(), create(), relationships, timestamps, soft deletes
Reflection-based DI Constructor dependencies resolved automatically β€” no manual wiring
Fluent Query Builder where(), join(), paginate(), orderBy() β€” all chainable
Validation 20+ built-in rules, custom messages, Form Request classes
In-memory Cache TTL, remember(), locks β€” Redis-like, zero dependencies
Event System Dispatch, wildcard listeners, broadcast channels
Job Queue Persistent async jobs, retries, Dispatchable trait
API Resources ApiResponse, JsonResource, ApiController base class
Schema & Migrations Fluent Blueprint, migrate / rollback / status
Testing Framework TestCase + HttpTestCase β€” no PHPUnit required
Zero-Bloat Install Unused code physically deleted after interactive setup

CLI reference

php rawr serve                       # Start Always-Alive Rust server
php rawr serve --port=8080           # Custom port
php rawr serve:php                   # PHP built-in server fallback

php rawr make:controller Name        # Generate controller
php rawr make:model Name             # Generate model
php rawr make:model Name --migration # Generate model + migration
php rawr make:migration Name         # Generate migration file
php rawr make:auth                   # Auth scaffolding
php rawr make:dash                   # Admin dashboard

php rawr migrate                     # Run pending migrations
php rawr migrate:rollback            # Rollback last batch
php rawr migrate:status              # Show migration status

Documentation

πŸ“– Documentation lygerphp.com
🌐 Mintlify Docs betoalien-lyger-php-framework.mintlify.app/introduction

Live demo

git clone https://github.com/betoalien/Lyger-PHP-v0.1-Dental-Clinic-Demo.git
cd Lyger-PHP-v0.1-Dental-Clinic-Demo
composer install
php rawr serve

Architecture overview

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  HTTP Requests ──▢ β”‚   Rust Axum HTTP Server      β”‚  Native I/O
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   β”‚ FFI callback
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   PHP Worker (Always-Alive)   β”‚  Zero restart
                    β”‚   Router Β· DI Β· ORM Β· Cache   β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   β”‚ FFI call
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   Rust Tokio Runtime          β”‚  Async I/O
                    β”‚   tokio-postgres Β· mysql_asyncβ”‚
                    β”‚   Result: opaque u64 pointer  β”‚  Zero-Copy
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

License

MIT β€” see LICENSE