LilaPHP

LilaPHP Framework

A lightweight, modular, and performance-first PHP 8.4+ API micro-framework designed for maximum execution speed, zero overhead, and native Docker orchestration. Install in seconds via Composer, deploy on any environment (Docker Nginx + PHP-FPM, VPS, or cloud containers), and build high-scale APIs with zero boilerplate.

Performance First

RAM-pinned OPcache (`preload.php`), C-level Nginx rate limiting (`limit_req`), and micro-second API response times under 2ms.

Anti-Malware Engine

Deep MIME verification via `finfo_open()`, anti-script inspection (`<?php` screening), and cryptographically randomized upload storage.

Background Workers

Offload heavy CSV processing, emails, and webhooks to Redis queues or detached OS processes (`Core\Task`) without blocking API workers.

Dual Routing & Views

Direct physical file-based execution in `app/routes/` for web views and `app/routes/api/` for REST APIs. Zero regex routing loops or complex middleware overhead.

Concurrent HTTP Client

High-speed `curl_multi_*` asynchronous pooling (`Core\Http`) to fetch multiple external microservices in parallel simultaneously.

PHP

CLI

Orchestrate Docker clusters (`php cli.php docker dev`), run dev hot reload (`php cli.php dev`), and manage database migrations directly from the console.

One-Command Installation

Install via Composer in seconds. Scaffolds a clean `_core/`, `app/`, `docker/`, and `public/` directory structure.

Native Docker & Nginx

Pre-configured Docker Compose cluster (`nginx:alpine` + `php:8.4-fpm` + `mysql:8.0` / `sqlite` + `redis:7`) optimized for production.

Dual Routing Architecture

Unified architecture serving pure JSON APIs from `app/routes/api/`, native server views from `app/routes/`, and static assets from `public/`.

Multi-Tier Caching

APCu in-memory RAM caching for local variables plus Redis for distributed sessions, rate limits, and job queues.

Production-Ready Optimizations

OPcache preloading, disabled logger output by default (`LOG_ENABLED=false`), and automatic security headers.

Zero Boilerplate

Clean, minimal PHP 8.4+ code. No complex dependency injection loops or heavy framework overhead.

Why Choose LilaPHP?

Traditional PHP frameworks load massive global state dictionaries, ORM layers, and template compilation pipelines on every HTTP request. LilaPHP takes a strict Performance First approach: physical file-based routing (`app/routes/` and `app/routes/api/`) combined with Nginx FastCGI direct dispatch. No heavy middleware overhead—just pure API and view execution.

All core classes (`Database`, `Cache`, `Response`, `Http`, `Upload`, `Task`, `View`) are pinned directly into RAM via OPcache preloading (`preload.php`). When an API worker boots up under PHP-FPM, memory allocation is near-zero and cold starts are eliminated.

Docker & Cloud Native: Pre-scaffolded with Docker Compose (`nginx:alpine`, `php:8.4-fpm`, `mysql:8.0` / `sqlite`, `redis:7-alpine`) and fully manageable via our master console tool (`php cli.php`).

app/routes/api/users.php
<?php
use Core\Response;
use Core\Database;
use Core\Cache;
use Core\Request;

Request::GET(function () {
    $pdo = Database::getInstance();
    $user = Cache::api('user_profile_123', function() use ($pdo) {
        $stmt = $pdo->prepare("SELECT id, name, email FROM users WHERE id = ?");
        $stmt->execute([123]);
        return $stmt->fetch();
    }, 60);

    return Response::json(['status' => 'ok', 'data' => $user]);
});

Installation & Quick Start

Get your full Docker cluster running in under 60 seconds.

1

Create Project via Composer

Scaffold the official LilaPHP project skeleton with its clean `_core/`, `app/`, `docker/`, and `public/` directories:

composer create-project seip25/lila-php LilaPHP
cd LilaPHP
2

Configure Environment & Security Key

Copy the example configuration to `.env` and generate a cryptographically random APP_KEY:

cp .env.example .env
php cli.php key:generate
3

Boot Docker Cluster (`docker dev`)

Or use php cli.php dev 8080

Use the master CLI command to build and launch your container orchestration (Nginx + PHP 8.4-FPM + MySQL + Redis):

                            php cli.php docker dev
                        

Or use this command for hot reload:

                            php cli.php dev 8080
                        

Once started, visit http://localhost:8080/api/test to inspect real-time APCu, Redis, and MySQL latency!

4

Production Cluster (`docker prod`)

When deploying to production, run our production stack command with strict caching, preloading, and static workers enabled:

php cli.php docker prod