betoalien/lyger

Lyger Framework v0.1 - PHP on steroids with Rust FFI

Maintainers

Package info

github.com/betoalien/Lyger-PHP-Framework

Type:project

pkg:composer/betoalien/lyger

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 10

Open Issues: 0

dev-main 2026-03-14 19:14 UTC

This package is auto-updated.

Last update: 2026-03-14 19:14:11 UTC


README

โšก Lyger Framework

The PHP framework that never sleeps.

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

PHP 8.0+ Rust License: MIT Version


๐Ÿ“– Documentation ย ยทย  ๐Ÿš€ Quick Start ย ยทย  ๐Ÿ“Š Benchmarks ย ยทย  ๐ŸŽฏ Demo

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

Real benchmarks. Same hardware. Same workload.

Operation Lyger Laravel Symfony Advantage
Database CRUD (1 000 ops) 1.09 ms 342.61 ms 340.92 ms 313ร—
JSON Serialization (1 000 obj) 6.62 ms 17.24 ms 17.67 ms 3ร—
Heavy Computation (10M iter) 112 ms 360 ms 357 ms 3.2ร—
Throughput (Hello World) 139M req/s 123M req/s 110M req/s +13%

The 313ร— database advantage comes from bypassing PDO entirely โ€” Rust's tokio-postgres and mysql_async handle queries asynchronously, and results never leave Rust's heap until you need the final JSON.

Quick Start

Requirements

  • PHP 8.0+ 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

๐Ÿ“– GitHub Pages betoalien.github.io/Lyger-PHP-Framework
๐ŸŒ 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