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
Installation Steps
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.
Install Dependencies
Install PHP dependencies using Composer:If you don’t have Composer installed globally, Lyger includes a local copy:
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
Configuration
Environment Setup
Copy the example environment file and configure your settings:.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)
Legacy Mode
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:- Check if FFI is available:
php -m | grep FFI - 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+
- Ubuntu/Debian:
- Ensure
ffi.enable = 1is in yourphp.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