PHPackages                             juneszh/alight - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. juneszh/alight

ActiveLibrary[Framework](/categories/framework)

juneszh/alight
==============

Alight is a light-weight PHP framework. Easily and quickly build high performance RESTful web applications.

v3.0.0(1mo ago)89446↓87.1%62MITPHPPHP &gt;=8.3CI passing

Since Aug 10Pushed 1mo ago9 watchersCompare

[ Source](https://github.com/juneszh/alight)[ Packagist](https://packagist.org/packages/juneszh/alight)[ RSS](/packages/juneszh-alight/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (10)Dependencies (16)Versions (18)Used By (2)

Alight
======

[](#alight)

Alight is a lightweight PHP framework that makes it easy to build high-performance RESTful web applications. It comes with built-in routing, database, caching, error handling, logging, and job scheduling. Alight focuses on the core requirements of web applications—simple by default, and extensible when you need to customize.

Alight Family
-------------

[](#alight-family)

ProjectDescription[Alight](https://github.com/juneszh/alight)Basic framework built-in routing, database, caching, etc.[Alight-Admin](https://github.com/juneszh/alight-admin)A full admin panel extension based on Alight. No front-end coding required.[Alight-Project](https://github.com/juneszh/alight-project)A template for beginner to easily create web applications by Alight/Alight-Admin.Requirements
------------

[](#requirements)

PHP 8.3+

Getting Started
---------------

[](#getting-started)

- [Installation](#installation)
- [Configuration](#configuration)
- [Routing](#routing)
- [Database](#database)
- [Caching](#caching)
- [Error Handling](#error-handling)
- [Job Scheduling](#job-scheduling)
- [Helpers](#helpers)

Installation
------------

[](#installation)

### Step 1: Install Composer

[](#step-1-install-composer)

Don’t have Composer? [Install Composer](https://getcomposer.org/download/) first.

### Step 2: Creating Project

[](#step-2-creating-project)

#### Using template with create-project

[](#using-template-with-create-project)

```
$ composer create-project juneszh/alight-project {PROJECT_DIRECTORY}
```

The project template contains common folder structure, suitable for MVC pattern, please refer to: [Alight-Project](https://github.com/juneszh/alight-project).

*It is easy to customize folders by modifying the configuration. But the following tutorials are based on the template configuration.*

### Step 3: Configuring a Web Server

[](#step-3-configuring-a-web-server)

Nginx example (Nginx 1.24.0, PHP 8.3.6, Ubuntu 24.04.4):

```
server {
    listen 80;
    listen [::]:80;

    root /var/www/{PROJECT_DIRECTORY}/public;

    index index.php;

    server_name {YOUR_DOMAIN};

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php-fpm.sock;
    }
}
```

Configuration
-------------

[](#configuration)

Alight loads its application configuration from `config/app.php`. Alight-Project creates this file from `config/app.example.php` during installation. For example:

File: config/app.php

```
