Skip to main content
Lyger is a high-performance PHP framework with Rust FFI integration that combines the simplicity of PHP with the speed of Rust. This guide will walk you through installing and configuring Lyger on your system.

Requirements

Before installing Lyger, ensure your system meets these requirements:

PHP 8.0 or higher

Lyger requires PHP 8.0 or later with modern PHP features

FFI Extension

The FFI extension must be enabled for Rust integration

PHP Version Check

You should see PHP 8.0 or higher in the output.

Installation Steps

1

Clone the Repository

Clone the Lyger Framework repository from GitHub:
2

Enable FFI Extension

Create a php.ini file in the root directory of your project:
php.ini
The FFI extension is required for Lyger’s Rust integration, which provides high-performance features like Always-Alive server mode and zero-copy database operations.
3

Install Dependencies

Install PHP dependencies using Composer:
If you don’t have Composer installed globally, Lyger includes a local copy:
4

Run the Interactive Installer (Optional)

Lyger includes a Zero-Bloat installer that configures your stack and removes unused components:
The installer will guide you through:
  • Architecture: API Headless or Full-Stack
  • Frontend: Vue.js, React, or Svelte (if Full-Stack)
  • Database: PostgreSQL, MySQL, or SQLite
  • Authentication: Lyger Session, JWT, or None
The installer removes unused files to keep your project lean. This is a one-time setup that cannot be undone.
5

Verify Installation

Start the development server:
Visit http://localhost:8000 in your browser. You should see the Lyger welcome page.

Configuration

Environment Setup

Copy the example environment file and configure your settings:
Edit the .env file to configure your application:

Supported Databases

Lyger supports multiple database engines through its Rust-powered query builder:
  • SQLite - Best for development and small applications
  • PostgreSQL - Best for complex queries and analytics
  • MySQL - Best for write-heavy CRUD applications
  • MariaDB - Compatible with MySQL configuration
  • MongoDB - NoSQL document database

Additional Configuration

The .env file includes other configuration options:
.env

Directory Structure

After installation, your Lyger project will have the following structure:

Server Modes

Lyger offers two server modes:

PHP Built-in Server (Default)

This mode uses PHP’s built-in development server.

Legacy Mode

Alternative command for the PHP built-in server.
The Always-Alive server mode with Rust HTTP server is available when the FFI extension is enabled and the Rust library is compiled.

Troubleshooting

FFI Extension Not Found

If you see an error about the FFI extension:
  1. Check if FFI is available: php -m | grep FFI
  2. If not available, install it via your package manager:
    • Ubuntu/Debian: sudo apt-get install php-ffi
    • macOS (Homebrew): FFI is included in PHP 8.0+
  3. Ensure ffi.enable = 1 is in your php.ini

Composer Install Fails

If Composer installation fails:

Port Already in Use

If port 8000 is already in use:

Next Steps

Now that you have Lyger installed, you’re ready to build your first application:

Quickstart Guide

Build your first Lyger application

Routing

Learn about routing and controllers

Database

Work with models and migrations

CLI Commands

Explore the Rawr CLI tool